File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1717#include " clang/AST/DeclarationName.h"
1818#include " clang/AST/Expr.h"
1919#include " clang/AST/ExprCXX.h"
20+ #include " clang/AST/ExprConcepts.h"
2021#include " clang/AST/ExprObjC.h"
2122#include " clang/AST/NestedNameSpecifier.h"
2223#include " clang/AST/PrettyPrinter.h"
@@ -279,6 +280,9 @@ struct TargetFinder {
279280 void VisitCallExpr (const CallExpr *CE) {
280281 Outer.add (CE->getCalleeDecl (), Flags);
281282 }
283+ void VisitConceptSpecializationExpr (const ConceptSpecializationExpr *E) {
284+ Outer.add (E->getNamedConcept (), Flags);
285+ }
282286 void VisitDeclRefExpr (const DeclRefExpr *DRE) {
283287 const Decl *D = DRE->getDecl ();
284288 // UsingShadowDecl allows us to record the UsingDecl.
Original file line number Diff line number Diff line change @@ -339,6 +339,24 @@ TEST_F(TargetDeclTest, ClassTemplate) {
339339 {" struct Test" , Rel::TemplatePattern});
340340}
341341
342+ TEST_F (TargetDeclTest, Concept) {
343+ Code = R"cpp(
344+ template <typename T>
345+ concept Fooable = requires (T t) { t.foo(); };
346+
347+ template <typename T> requires [[Fooable]]<T>
348+ void bar(T t) {
349+ t.foo();
350+ }
351+ )cpp" ;
352+ Flags.push_back (" -std=c++2a" );
353+ EXPECT_DECLS (
354+ " ConceptSpecializationExpr" ,
355+ // FIXME: Should we truncate the pretty-printed form of a concept decl
356+ // somewhere?
357+ {" template <typename T> concept Fooable = requires (T t) { t.foo(); };" });
358+ }
359+
342360TEST_F (TargetDeclTest, FunctionTemplate) {
343361 Code = R"cpp(
344362 // Implicit specialization.
You can’t perform that action at this time.
0 commit comments