diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-01 21:06:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-01 21:06:03 +0000 |
commit | e6794974b706ddd51e65dcea411a6378a0f16a2e (patch) | |
tree | 6af856c27c3108132dc95e21b7ab115937a46763 /lib/Sema/SemaDecl.cpp | |
parent | 6d97e5e4b7abdae710c2548b51f4ed0298e86d80 (diff) |
fix PR5933: don't warn about unused variables if a function has other errors in it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97498 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index be4a591f29..4842da2a7b 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -553,7 +553,8 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) { if (!D->getDeclName()) continue; // Diagnose unused variables in this scope. - if (ShouldDiagnoseUnusedDecl(D)) + if (ShouldDiagnoseUnusedDecl(D) && + NumErrorsAtStartOfFunction == getDiagnostics().getNumErrors()) Diag(D->getLocation(), diag::warn_unused_variable) << D->getDeclName(); // Remove this name from our lexical scope. |