================
@@ -18,9 +18,13 @@ using namespace clang::ast_matchers;
namespace clang::tidy::readability {
void RedundantTypenameCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(typeLoc(unless(hasAncestor(decl(isInstantiated()))))
- .bind("nonDependentTypeLoc"),
- this);
+ Finder->addMatcher(
+ typeLoc(loc(TypeMatcher(anyOf(typedefType(), tagType(),
+ deducedTemplateSpecializationType(),
+ templateSpecializationType()))),
+ unless(hasAncestor(decl(isInstantiated()))))
+ .bind("nonDependentTypeLoc"),
+ this);
----------------
5chmidti wrote:
Can't we skip the `hasAncestor` part (I'd keep the anyOf you added anyways
since we are producing less matches that way, which also improves perf)
```c++
typeLoc(loc(qualType(unless(dependentNameType())))
```
?
Then we are not checking a type that is dependent, which eliminates the need
for the `hasAncestor` and also the
```c++
if (NonDependentTypeLoc->getType()->isDependentType())
return SourceLocation();
```
later
https://github.com/llvm/llvm-project/pull/170540
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits