[cfe-commits] r88834 - /cfe/trunk/lib/Sema/SemaDecl.cpp
Douglas Gregor
dgregor at apple.com
Sat Nov 14 23:07:58 PST 2009
Author: dgregor
Date: Sun Nov 15 01:07:58 2009
New Revision: 88834
URL: http://llvm.org/viewvc/llvm-project?rev=88834&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=88834&r1=88833&r2=88834&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Nov 15 01:07:58 2009
@@ -4026,6 +4026,12 @@
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;
}
More information about the cfe-commits
mailing list