[PATCH] Rewrite eachOf/allOf/anyOf to use a variadic operator.

Samuel Benzaquen sbenza at google.com
Fri Aug 16 13:48:16 PDT 2013


  The reason I can't see this implemented using llvm::VariadicFunction is that *Of() has arbitrary arguments, than then get converted into Matcher<T> when the variadic is bound on the outer matcher.
  llvm::VariadicFunction needs one specific type on its declaration.
  Some of the arguments might not even be Matcher<*> (eg could be another polymorphic object) so we can't make it a variadic function on const DynTypedMatcher&.
  I am willing to simplify/merge the logic if you see a way.


================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:61
@@ +60,3 @@
+    BoundNodesTreeBuilder BuilderI(*Builder);
+    bool MatchedI = InnerMatchers[i]->matches(DynNode, Finder, &BuilderI);
+    if (MatchedI) {
----------------
Manuel Klimek wrote:
> Any reason to have this variable pulled out?
It was out on the previous implementation, but I don't need it anymore so its gone.

================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:60
@@ +59,3 @@
+  for (size_t i = 0, e = InnerMatchers.size(); i != e; ++i) {
+    BoundNodesTreeBuilder BuilderI(*Builder);
+    bool MatchedI = InnerMatchers[i]->matches(DynNode, Finder, &BuilderI);
----------------
Manuel Klimek wrote:
> I assume "I" stands for "Inner"? I'd rather type that out ;) (here and below)
Done.


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



More information about the cfe-commits mailing list