зеркало из https://github.com/microsoft/clang-1.git
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:
Родитель
d58c03f42e
Коммит
d5b57281cc
lib/Sema
|
@ -4026,6 +4026,12 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,
|
||||||
if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(dcl))
|
if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(dcl))
|
||||||
computeBaseOrMembersToDestroy(Destructor);
|
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");
|
assert(ExprTemporaries.empty() && "Leftover temporaries in function");
|
||||||
return D;
|
return D;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче