If any errors have occurred by the time we hit the end of a function body, clear out any remaining temporaries so they aren't seen later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88834 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2009-11-15 07:07:58 +00:00
Родитель d58c03f42e
Коммит d5b57281cc
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -4026,6 +4026,12 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,
if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(dcl))
computeBaseOrMembersToDestroy(Destructor);
// 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())
ExprTemporaries.clear();
assert(ExprTemporaries.empty() && "Leftover temporaries in function");
return D;
}