summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-04-20 08:58:27 +0000
committerDaniel Jasper <djasper@google.com>2016-04-20 08:58:27 +0000
commita204c0ad180b27281985a9fd38b39f328cd1683b (patch)
treec9367c51d971010c5d4495c28c01780109dfbac8 /clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
parent89406d1815ddf8d88e9450bf3f980cfc2b625d99 (diff)
downloadbcm5719-llvm-a204c0ad180b27281985a9fd38b39f328cd1683b.tar.gz
bcm5719-llvm-a204c0ad180b27281985a9fd38b39f328cd1683b.zip
clang-tidy: [misc-unused-using-decls] Always use the canonical decl to
identify things. This fixes llvm.org/PR27430. llvm-svn: 266864
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
index 5d93357e398..b2aff4d1471 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -30,7 +30,8 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
// than one shadow.
if (Using->shadow_size() != 1)
return;
- const auto* TargetDecl = Using->shadow_begin()->getTargetDecl();
+ const auto *TargetDecl =
+ Using->shadow_begin()->getTargetDecl()->getCanonicalDecl();
// FIXME: Handle other target types.
if (!isa<RecordDecl>(TargetDecl))
@@ -52,8 +53,9 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
// FIXME: This currently doesn't look at whether the type reference is
// actually found with the help of the using declaration.
if (const auto *Used = Result.Nodes.getNodeAs<NamedDecl>("used")) {
- if (FoundDecls.find(Used) != FoundDecls.end())
- FoundDecls[Used] = nullptr;
+ auto I = FoundDecls.find(Used->getCanonicalDecl());
+ if (I != FoundDecls.end())
+ I->second = nullptr;
}
}
OpenPOWER on IntegriCloud