[PATCH] Adds the equalsBoundNode matcher.

Manuel Klimek klimek at google.com
Thu Jun 20 02:29:25 PDT 2013



================
Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:150
@@ +149,3 @@
+      if (Predicate(Bindings[i])) {
+        Result.push_back(Bindings[i]);
+      }
----------------
Edwin Vane wrote:
> Alexander Kornienko wrote:
> > It seems that you're trying to re-invent std::remove_if here ;)
> > 
> > If it's done for performance reasons, then I'm not sure .swap is particularly fast for SmallVector when using in-object storage.
> I was thinking of this too but can we use std::remove_if on SmallVector?
Nope, it was done because of ignorance - I don't get to work with the std libraries enough :) Fixed, and inverted the logic of the function...

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2260
@@ +2259,3 @@
+namespace internal {
+struct PredicateT {
+  bool operator()(const internal::BoundNodesMap &Nodes) const {
----------------
Edwin Vane wrote:
> Should this be called equalsboundNodePredicate? Possibly even being made a nested struct within the matcher below? Or do you envision this being used elsewhere?
Yea, that was still left to clean up. Unfortunately I cannot put it into the matcher, because local types are not allowed as template parameters :( I called it NotEqualsBoundNodePredicate...


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



More information about the cfe-commits mailing list