Fix isInstantiated and isInTemplateInstantiation to not recreate the matchers on...
authorSamuel Benzaquen <sbenza@google.com>
Mon, 8 Dec 2014 20:17:58 +0000 (20:17 +0000)
committerSamuel Benzaquen <sbenza@google.com>
Mon, 8 Dec 2014 20:17:58 +0000 (20:17 +0000)
commit96a39a5a4791944e00680a25981850bd8c5241b5
treee824bd42fe8053a1819127b5f152666192f84d65
parentac4744ec8654fe922388808476f5a2e32731f669
Fix isInstantiated and isInTemplateInstantiation to not recreate the matchers on each call.

Summary:
Store the result matcher after the first call and reuse it later on.
Recreating the matchers just to use them once incurs in a lot of
unnecessary temporary memory allocations.
This change speeds up our clang-tidy benchmarks by ~2%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 223690
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/include/clang/ASTMatchers/ASTMatchersInternal.h
clang/include/clang/ASTMatchers/ASTMatchersMacros.h