When diagnostics are suppressed (e.g., because of code completion), don't trigger the ExprTemplates.empty() check at the end of a function body

llvm-svn: 127046
This commit is contained in:
Douglas Gregor 2011-03-04 23:08:02 +00:00
parent 9e8963acfd
commit 550b98b1c5
1 changed files with 2 additions and 1 deletions

View File

@ -5697,7 +5697,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
// If any errors have occurred, clear out any temporaries that may have
// been leftover. This ensures that these temporaries won't be picked up for
// deletion in some later function.
if (PP.getDiagnostics().hasErrorOccurred())
if (PP.getDiagnostics().hasErrorOccurred() ||
PP.getDiagnostics().getSuppressAllDiagnostics())
ExprTemporaries.clear();
else if (!isa<FunctionTemplateDecl>(dcl)) {
// Since the body is valid, issue any analysis-based warnings that are