diff options
author | Samuel Benzaquen <sbenza@google.com> | 2013-11-18 14:53:42 +0000 |
---|---|---|
committer | Samuel Benzaquen <sbenza@google.com> | 2013-11-18 14:53:42 +0000 |
commit | 464c1cbc3fac25ad84ce0ed79e49ae43fd3db686 (patch) | |
tree | a849e569dba1362e861f547e374344fcf68a3b6f /clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp | |
parent | 60ecf38133cb8df79ec6378c801df57a8f60af75 (diff) | |
download | bcm5719-llvm-464c1cbc3fac25ad84ce0ed79e49ae43fd3db686.tar.gz bcm5719-llvm-464c1cbc3fac25ad84ce0ed79e49ae43fd3db686.zip |
Add partial support for the hasDeclaration() matcher in the dynamic layer.
Summary:
Add partial support for the hasDeclaration() matcher in the dynamic layer.
This matcher has some special logic to allow any type that has a getDecl() method. We do not support this right now.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1889
llvm-svn: 195013
Diffstat (limited to 'clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp index 9a24c80cc7f..e716484e207 100644 --- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp @@ -179,6 +179,19 @@ TEST_F(RegistryTest, PolymorphicMatchers) { EXPECT_FALSE(matches("int Foo;", RecordDecl)); EXPECT_TRUE(matches("class Foo {};", RecordDecl)); EXPECT_FALSE(matches("void Foo(){};", RecordDecl)); + + Matcher<Stmt> ConstructExpr = constructMatcher( + "constructExpr", + constructMatcher( + "hasDeclaration", + constructMatcher( + "methodDecl", + constructMatcher( + "ofClass", constructMatcher("hasName", std::string("Foo")))))) + .getTypedMatcher<Stmt>(); + EXPECT_FALSE(matches("class Foo { public: Foo(); };", ConstructExpr)); + EXPECT_TRUE( + matches("class Foo { public: Foo(); }; Foo foo = Foo();", ConstructExpr)); } TEST_F(RegistryTest, TemplateArgument) { |