Author: Congcong Cai Date: 2025-01-23T06:28:43+08:00 New Revision: 68c6b2e18809342e3747d50eb0dc84246393941b
URL: https://github.com/llvm/llvm-project/commit/68c6b2e18809342e3747d50eb0dc84246393941b DIFF: https://github.com/llvm/llvm-project/commit/68c6b2e18809342e3747d50eb0dc84246393941b.diff LOG: [ASTMatchers][NFC] use `Matcher<QualType>` instead of `DynTypedMatcher` in `TypeLocTypeMatcher` (#123450) There are no template in `TypeLocTypeMatcher`. So we do not need to use `DynTypedMatcher` which can improve performance Added: Modified: clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp clang/include/clang/ASTMatchers/ASTMatchersInternal.h Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp index 1ff61bae46b1ed..4448e9ccba80d9 100644 --- a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp @@ -10,6 +10,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" #include "clang/Lex/Lexer.h" using namespace clang::ast_matchers; diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index 1f7b5e7cac8465..55a925bf869091 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -1804,7 +1804,7 @@ class LocMatcher : public MatcherInterface<TLoc> { /// /// Used to implement the \c loc() matcher. class TypeLocTypeMatcher : public MatcherInterface<TypeLoc> { - DynTypedMatcher InnerMatcher; + Matcher<QualType> InnerMatcher; public: explicit TypeLocTypeMatcher(const Matcher<QualType> &InnerMatcher) @@ -1814,8 +1814,7 @@ class TypeLocTypeMatcher : public MatcherInterface<TypeLoc> { BoundNodesTreeBuilder *Builder) const override { if (!Node) return false; - return this->InnerMatcher.matches(DynTypedNode::create(Node.getType()), - Finder, Builder); + return this->InnerMatcher.matches(Node.getType(), Finder, Builder); } }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits