]> granicus.if.org Git - clang/commit
Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.
authorSamuel Benzaquen <sbenza@google.com>
Wed, 1 Oct 2014 15:08:07 +0000 (15:08 +0000)
committerSamuel Benzaquen <sbenza@google.com>
Wed, 1 Oct 2014 15:08:07 +0000 (15:08 +0000)
commitb01e48d0bc75a19ff3a628d8400bfc7f057c35b9
tree35c284b88f0f7861e7c13662aa04d9081a4030e0
parent3a8811e15fbf1f7493387bfe24fb8f1a110955fa
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/D5542

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218769 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/ASTTypeTraits.h
include/clang/ASTMatchers/ASTMatchersInternal.h
lib/ASTMatchers/ASTMatchFinder.cpp
lib/ASTMatchers/ASTMatchersInternal.cpp
unittests/ASTMatchers/ASTMatchersTest.cpp
unittests/ASTMatchers/Dynamic/ParserTest.cpp