summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-08-03 10:52:27 +0000
committerDaniel Jasper <djasper@google.com>2015-08-03 10:52:27 +0000
commitcf452e55019f09097b9e59fda820375ed6bbd776 (patch)
tree5005b85f7161bb11e180167595eea6d6d29aede9 /clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp
parentd9eab9cc130d4c2840923c5345ea8d591e083be1 (diff)
downloadbcm5719-llvm-cf452e55019f09097b9e59fda820375ed6bbd776.tar.gz
bcm5719-llvm-cf452e55019f09097b9e59fda820375ed6bbd776.zip
Replace callback-if with isExpansionInMainFile as suggested in post
commit review. llvm-svn: 243871
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp10
1 files changed, 4 insertions, 6 deletions
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<Decl>("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(
OpenPOWER on IntegriCloud