}
void UnusedAliasDeclsCheck::check(const MatchFinder::MatchResult &Result) {
- if (const auto *AliasDecl = Result.Nodes.getNodeAs<Decl>("alias")) {
+ if (const auto *AliasDecl = Result.Nodes.getNodeAs<NamedDecl>("alias")) {
FoundDecls[AliasDecl] = CharSourceRange::getCharRange(
AliasDecl->getLocStart(),
Lexer::findLocationAfterToken(
for (const auto &FoundDecl : FoundDecls) {
if (!FoundDecl.second.isValid())
continue;
- diag(FoundDecl.first->getLocation(), "this namespace alias decl is unused")
+ diag(FoundDecl.first->getLocation(), "namespace alias decl '%0' is unused")
+ << FoundDecl.first->getName()
<< FixItHint::CreateRemoval(FoundDecl.second);
}
}
}
namespace unused_alias = ::my_namespace; // eol-comments aren't removed (yet)
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: this namespace alias decl is unused
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: namespace alias decl 'unused_alias' is unused
// CHECK-FIXES: {{^}}// eol-comments aren't removed (yet)
namespace used_alias = ::my_namespace;