[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
This commit is contained in:
Congcong Cai 2025-01-23 06:28:43 +08:00 committed by GitHub
parent ac94fade60
commit 68c6b2e188
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -1804,7 +1804,7 @@ private:
///
/// 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 @@ public:
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);
}
};