Skip to content

Commit ee11034

Browse files
committedSep 29, 2014
Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.
Summary: This change introduces DynMatcherInterface and changes the internal representation of DynTypedMatcher and Matcher<T> to use a generic interface instead. It removes unnecessary indirections and virtual function calls when converting matchers by implicit and dynamic casts. DynTypedMatcher now remembers the stricter type in the chain of casts and checks it before calling into DynMatcherInterface. This change improves our clang-tidy related benchmark by ~14%. Also, it opens the door for more optimizations of this kind that are coming in future changes. As a side effect of removing these template instantiations, it also speeds up compilation of Dynamic/Registry.cpp by ~17% and reduces the number of symbols generated by ~30%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5485 llvm-svn: 218616
1 parent 8a0bad0 commit ee11034

File tree

6 files changed

+307
-214
lines changed

6 files changed

+307
-214
lines changed
 

‎clang/include/clang/AST/ASTTypeTraits.h

+2
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ class DynTypedNode {
191191
return BaseConverter<T>::get(NodeKind, Storage.buffer);
192192
}
193193

194+
ASTNodeKind getNodeKind() const { return NodeKind; }
195+
194196
/// \brief Returns a pointer that identifies the stored AST node.
195197
///
196198
/// Note that this is not supported by all AST nodes. For AST nodes

0 commit comments

Comments
 (0)
Please sign in to comment.