[cfe-commits] [PATCH] Implement hasParent()-matcher
Manuel Klimek
klimek at google.com
Mon Oct 22 08:11:19 PDT 2012
Otherwise LG.
================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:1417
@@ +1416,3 @@
+internal::ArgumentAdaptingMatcher<internal::HasParentMatcher, ParentT>
+hasParent(const internal::Matcher<ParentT> &AncestorMatcher) {
+ return internal::ArgumentAdaptingMatcher<
----------------
s/Ancestor/Parent/
================
Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:503
@@ -503,1 +502,3 @@
+ BoundNodesTreeBuilder *Builder,
+ bool ParentOnly) {
TOOLING_COMPILE_ASSERT((llvm::is_base_of<Decl, T>::value ||
----------------
I would use an enum...
================
Comment at: unittests/ASTMatchers/ASTMatchersTest.cpp:2892
@@ +2891,3 @@
+ EXPECT_TRUE(notMatches(
+ "void f() { for (;;) { int x = 42; } }",
+ compoundStmt(hasParent(ifStmt()))));
----------------
Please add a test:
notMatches("void f() { if (true) for (;;) { int x = 42; } }")
http://llvm-reviews.chandlerc.com/D71
More information about the cfe-commits
mailing list