Skip to content

Commit 68c6b2e

Browse files
authored
[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
1 parent ac94fad commit 68c6b2e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/AST/Decl.h"
1212
#include "clang/ASTMatchers/ASTMatchFinder.h"
13+
#include "clang/ASTMatchers/ASTMatchers.h"
1314
#include "clang/Lex/Lexer.h"
1415

1516
using namespace clang::ast_matchers;

clang/include/clang/ASTMatchers/ASTMatchersInternal.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ class LocMatcher : public MatcherInterface<TLoc> {
18041804
///
18051805
/// Used to implement the \c loc() matcher.
18061806
class TypeLocTypeMatcher : public MatcherInterface<TypeLoc> {
1807-
DynTypedMatcher InnerMatcher;
1807+
Matcher<QualType> InnerMatcher;
18081808

18091809
public:
18101810
explicit TypeLocTypeMatcher(const Matcher<QualType> &InnerMatcher)
@@ -1814,8 +1814,7 @@ class TypeLocTypeMatcher : public MatcherInterface<TypeLoc> {
18141814
BoundNodesTreeBuilder *Builder) const override {
18151815
if (!Node)
18161816
return false;
1817-
return this->InnerMatcher.matches(DynTypedNode::create(Node.getType()),
1818-
Finder, Builder);
1817+
return this->InnerMatcher.matches(Node.getType(), Finder, Builder);
18191818
}
18201819
};
18211820

0 commit comments

Comments
 (0)