[PATCH] Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.

Manuel Klimek klimek at google.com
Thu Sep 25 06:46:30 PDT 2014


================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:54-60
@@ +53,9 @@
+
+  bool matches(const ast_type_traits::DynTypedNode &DynNode,
+               ASTMatchFinder *Finder,
+               BoundNodesTreeBuilder *Builder) const override {
+    bool Result = InnerMatcher->matches(DynNode, Finder, Builder);
+    if (Result) Builder->setBinding(ID, DynNode);
+    return Result;
+  }
+
----------------
sbenza wrote:
> klimek wrote:
> > Can we somehow put this implementation and the IdMatcher implementation closer together? I'm concerned if somebody changes one and the other breaks.
> My plan is to refector all template matcher that do not need the type into DynMatcherInterface. That includes IdMatcher, TrueMatcher, VariadicOperator, etc.
> I did not do it on this change to limit the scope. Added some FIXME for them, though.
sg

http://reviews.llvm.org/D5485






More information about the cfe-commits mailing list