Skip some unnecessary type checks.
authorSamuel Benzaquen <sbenza@google.com>
Tue, 2 Dec 2014 18:29:00 +0000 (18:29 +0000)
committerSamuel Benzaquen <sbenza@google.com>
Tue, 2 Dec 2014 18:29:00 +0000 (18:29 +0000)
commitb6f0a83f417e857c27be13d625e9f205feab777d
tree95e0871aa9a01115206d6e6602e3638ff6813a05
parent54b7d334c7d1c5e0a28f91852fdbeae2da464565
Skip some unnecessary type checks.

Summary:
Skip some unnecessary type checks wrt DynTypedNodes.
Add DynTypedNode::getUnchecked() to skip the runtime check when the type
is known.
Speed up DynTypedNode::operator== by using isSame() instead of
isBaseOf().
Skip the type check in MatcherInterface<T>::matches(). All calls come
from DynTypedMatcher::matches(), which already did the type check.
This change speeds up our clang-tidy benchmark by ~4%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6468

llvm-svn: 223134
clang/include/clang/AST/ASTTypeTraits.h
clang/include/clang/ASTMatchers/ASTMatchersInternal.h