diff options
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 338b059e53c..aec3b7cd3bd 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -340,29 +340,25 @@ unsigned Decl::getMaxAlignment() const { return Align; } -bool Decl::isUsed(bool CheckUsedAttr) const { - const Decl *CanonD = getCanonicalDecl(); - if (CanonD->Used) +bool Decl::isUsed(bool CheckUsedAttr) const { + if (Used) return true; - + // Check for used attribute. - // Ask the most recent decl, since attributes accumulate in the redecl chain. - if (CheckUsedAttr && getMostRecentDecl()->hasAttr<UsedAttr>()) + if (CheckUsedAttr && hasAttr<UsedAttr>()) return true; - // The information may have not been deserialized yet. Force deserialization - // to complete the needed information. - return getMostRecentDecl()->getCanonicalDecl()->Used; + return false; } void Decl::markUsed(ASTContext &C) { - if (isUsed()) + if (Used) return; if (C.getASTMutationListener()) C.getASTMutationListener()->DeclarationMarkedUsed(this); - setIsUsed(); + Used = true; } bool Decl::isReferenced() const { |