diff options
Diffstat (limited to 'compilerplugins/clang/unusedmember.cxx')
-rw-r--r-- | compilerplugins/clang/unusedmember.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compilerplugins/clang/unusedmember.cxx b/compilerplugins/clang/unusedmember.cxx index bfd4f591616d..8239b5ae1d8d 100644 --- a/compilerplugins/clang/unusedmember.cxx +++ b/compilerplugins/clang/unusedmember.cxx @@ -94,6 +94,21 @@ public: #endif + bool VisitDeclaratorDecl(DeclaratorDecl const* decl) + { + // For declarations like + // + // enum E { ... } e; + // + // it may be that the declaration of E is not marked as referenced even though the + // declaration of e clearly references it: + if (auto const t = decl->getType()->getAs<EnumType>()) + { + deferred_.erase(t->getDecl()); + } + return true; + } + bool VisitCXXRecordDecl(CXXRecordDecl const* decl) //TODO: non-CXX RecordDecl? { if (ignoreLocation(decl)) |