From cf452e55019f09097b9e59fda820375ed6bbd776 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 3 Aug 2015 10:52:27 +0000 Subject: Replace callback-if with isExpansionInMainFile as suggested in post commit review. llvm-svn: 243871 --- clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp') diff --git a/clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp b/clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp index a56c1bfa8bd..0b596922341 100644 --- a/clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp @@ -22,17 +22,15 @@ const ast_matchers::internal::VariadicDynCastAllOfMatcher< Decl, NamespaceAliasDecl> namespaceAliasDecl; void UnusedAliasDeclsCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher(namespaceAliasDecl().bind("alias"), this); + // We cannot do anything about headers (yet), as the alias declarations + // used in one header could be used by some other translation unit. + Finder->addMatcher(namespaceAliasDecl(isExpansionInMainFile()).bind("alias"), + this); Finder->addMatcher(nestedNameSpecifier().bind("nns"), this); } void UnusedAliasDeclsCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *AliasDecl = Result.Nodes.getNodeAs("alias")) { - // We cannot do anything about headers (yet), as the alias declarations used - // in one header could be used by some other translation unit. - if (!Result.SourceManager->isInMainFile(AliasDecl->getLocation())) - return; - FoundDecls[AliasDecl] = CharSourceRange::getCharRange( AliasDecl->getLocStart(), Lexer::findLocationAfterToken( -- cgit v1.2.3