diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-11-15 07:07:58 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-11-15 07:07:58 +0000 |
commit | a7e3ea3f64ae918030883b253ab6cdb304efbdab (patch) | |
tree | 3174cd11101a0712d90faff49597886b53c910d2 /clang | |
parent | b9bbd54fdb5b88b9f0048d1bf025e76e6a1ec306 (diff) | |
download | bcm5719-llvm-a7e3ea3f64ae918030883b253ab6cdb304efbdab.tar.gz bcm5719-llvm-a7e3ea3f64ae918030883b253ab6cdb304efbdab.zip |
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.
llvm-svn: 88834
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 65e839b04db..34e9acb9adb 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -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; } |