[cfe-commits] [PATCH] Implement hasParent()-matcher

Daniel Jasper djasper at google.com
Mon Oct 22 09:29:39 PDT 2012


  Submitted as r166421.


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:1417
@@ +1416,3 @@
+internal::ArgumentAdaptingMatcher<internal::HasParentMatcher, ParentT>
+hasParent(const internal::Matcher<ParentT> &AncestorMatcher) {
+  return internal::ArgumentAdaptingMatcher<
----------------
Manuel Klimek wrote:
> s/Ancestor/Parent/
Done.

================
Comment at: unittests/ASTMatchers/ASTMatchersTest.cpp:2892
@@ +2891,3 @@
+  EXPECT_TRUE(notMatches(
+      "void f() { for (;;) { int x = 42; } }",
+      compoundStmt(hasParent(ifStmt()))));
----------------
Manuel Klimek wrote:
> Please add a test:
> notMatches("void f() { if (true) for (;;) { int x = 42; } }")
Done.

================
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 ||
----------------
Manuel Klimek wrote:
> I would use an enum...
Done.


http://llvm-reviews.chandlerc.com/D71



More information about the cfe-commits mailing list