summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
diff options
context:
space:
mode:
authorSamuel Benzaquen <sbenza@google.com>2013-07-17 14:28:00 +0000
committerSamuel Benzaquen <sbenza@google.com>2013-07-17 14:28:00 +0000
commit06e056c4d895c4a74951caf5a382fd2fca03327f (patch)
tree1866fe055244b4b378f67fa35865f6da8e1d1f99 /clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
parent29410f9c917dde933050b1b1acd4e03f82823747 (diff)
downloadbcm5719-llvm-06e056c4d895c4a74951caf5a382fd2fca03327f.tar.gz
bcm5719-llvm-06e056c4d895c4a74951caf5a382fd2fca03327f.zip
Add CXXCtorInitializer related matchers to the dynamic matcher registry.
Summary: Now that CXXCtorInitializer is already supported in ASTNodeKind, add CXXCtorInitializer matchers to the dynamic matcher registry. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1158 llvm-svn: 186508
Diffstat (limited to 'clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
index b7e29ed0cbb..d0d42740ab0 100644
--- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -173,6 +173,17 @@ TEST_F(RegistryTest, TypeTraversal) {
EXPECT_TRUE(matches("int b[7];", M));
}
+TEST_F(RegistryTest, CXXCtorInitializer) {
+ Matcher<Decl> CtorDecl = constructMatcher(
+ "constructorDecl",
+ constructMatcher("hasAnyConstructorInitializer",
+ constructMatcher("forField", hasName("foo"))))
+ .getTypedMatcher<Decl>();
+ EXPECT_TRUE(matches("struct Foo { Foo() : foo(1) {} int foo; };", CtorDecl));
+ EXPECT_FALSE(matches("struct Foo { Foo() {} int foo; };", CtorDecl));
+ EXPECT_FALSE(matches("struct Foo { Foo() : bar(1) {} int bar; };", CtorDecl));
+}
+
TEST_F(RegistryTest, Errors) {
// Incorrect argument count.
OwningPtr<Diagnostics> Error(new Diagnostics());
OpenPOWER on IntegriCloud