[PATCH] Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.
Manuel Klimek
klimek at google.com
Thu Sep 25 01:10:17 PDT 2014
Wizardry! Nice benchmark numbers :)
================
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;
+ }
+
----------------
Can we somehow put this implementation and the IdMatcher implementation closer together? I'm concerned if somebody changes one and the other breaks.
================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:95-96
@@ +94,4 @@
+ DynTypedMatcher Result = InnerMatchers[0];
+ // Use the least derived type as the restriction for the wrapper.
+ // This allows mismatch to be resolved on the inner matchers.
+ for (const DynTypedMatcher &M : InnerMatchers) {
----------------
"mismatches" or "a mismatch"?
http://reviews.llvm.org/D5485
More information about the cfe-commits
mailing list