From 96039d727b3dfb190f23027aa62ec1718255ffa7 Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Thu, 9 Oct 2014 19:28:18 +0000 Subject: Special case 0 and 1 matcher in makeAllOfComposite(). Summary: Remove unnecessary wrapping for the 0 and 1 matcher cases of makeAllOfComposite(). We don't need a variadic wrapper for those cases. Refactor TrueMatcher to take advandage of the new conversions between DynTypedMatcher and Matcher. Also, make it a singleton. This change improves our clang-tidy related benchmarks by ~12%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5675 llvm-svn: 219431 --- clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp') diff --git a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp index ed507d57333..2a9a61b543d 100644 --- a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp @@ -26,7 +26,10 @@ public: virtual ~MockSema() {} uint64_t expectMatcher(StringRef MatcherName) { - ast_matchers::internal::Matcher M = stmt(); + // Optimizations on the matcher framework make simple matchers like + // 'stmt()' to be all the same matcher. + // Use a more complex expression to prevent that. + ast_matchers::internal::Matcher M = stmt(stmt(), stmt()); ExpectedMatchers.insert(std::make_pair(MatcherName, M)); return M.getID().second; } -- cgit v1.2.3