diff options
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 6239172a09..09ea825e1a 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -332,6 +332,9 @@ static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D) { if (D->getMostRecentDecl()->isUsed()) return true; + if (D->hasExternalLinkage()) + return true; + if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { // UnusedFileScopedDecls stores the first declaration. // The declaration may have become definition so check again. @@ -360,9 +363,6 @@ static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D) { return !SemaRef->ShouldWarnIfUnusedFileScopedDecl(DeclToCheck); } - if (D->hasExternalLinkage()) - return true; - return false; } |