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 | efc83e60d349da075491f03373ffed92065afb0a (patch) | |
| tree | 4d71d46a3376d40f0f2d023e86e6bbc7cee18a80 /clang/lib/Sema | |
| parent | 30d0cfda354ec7f271ff3fa006db02d10a9e9610 (diff) | |
| download | bcm5719-llvm-efc83e60d349da075491f03373ffed92065afb0a.tar.gz bcm5719-llvm-efc83e60d349da075491f03373ffed92065afb0a.zip | |
fix PR5933: don't warn about unused variables if a function has other errors in it.
llvm-svn: 97498
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index be4a591f29a..4842da2a7b5 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/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. |

