summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
index 7499190d5c3..30ff7b80a6c 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -19,12 +19,13 @@ namespace tidy {
namespace misc {
// A function that helps to tell whether a TargetDecl in a UsingDecl will be
-// checked. Only variable, function, function template, class template and class
-// are considered.
+// checked. Only variable, function, function template, class template, class,
+// enum declaration and enum constant declaration are considered.
static bool ShouldCheckDecl(const Decl *TargetDecl) {
return isa<RecordDecl>(TargetDecl) || isa<ClassTemplateDecl>(TargetDecl) ||
isa<FunctionDecl>(TargetDecl) || isa<VarDecl>(TargetDecl) ||
- isa<FunctionTemplateDecl>(TargetDecl);
+ isa<FunctionTemplateDecl>(TargetDecl) || isa<EnumDecl>(TargetDecl) ||
+ isa<EnumConstantDecl>(TargetDecl);
}
void UnusedUsingDeclsCheck::registerMatchers(MatchFinder *Finder) {
@@ -91,6 +92,8 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
removeFromFoundDecls(FD);
} else if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) {
removeFromFoundDecls(VD);
+ } else if (const auto *ECD = dyn_cast<EnumConstantDecl>(DRE->getDecl())) {
+ removeFromFoundDecls(ECD);
}
}
// Check the uninstantiated template function usage.
OpenPOWER on IntegriCloud