aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGTemporaries.cpp
AgeCommit message (Collapse)Author
2011-11-27When destroying temporaries, instead of a custom cleanup use thePeter Collingbourne
generic pushDestroy function. This would reduce the number of useful declarations in CGTemporaries.cpp to one. Since CodeGenFunction::EmitCXXTemporary does not deserve its own file, move it to CGCleanup.cpp and delete CGTemporaries.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145202 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10Enter the cleanups for a block outside the enclosingJohn McCall
full-expression. Naturally they're inactive before we enter the block literal expression. This restores the intended behavior that blocks belong to their enclosing scope. There's a useful -O0 / compile-time optimization that we're missing here with activating cleanups following straight-line code from their inactive beginnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144268 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-12Generalize Cleanup::Emit's "isForEH" parameter into a setJohn McCall
of flags. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134997 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-12Do full-expression cleanups in a much more sensible way that still letsJohn McCall
people write useful cleanup classes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134942 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26Fix some obvious bugs in the conditional-cleanup code and then make theJohn McCall
dtor cleanup use it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124309 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26Better framework for conditional cleanups; untested as yet.John McCall
I'm separately committing this because it incidentally changes some block orderings and minor IR issues, like using a phi instead of an unnecessary alloca. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124277 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall
reason this is limited to C++, and it's certainly not limited to temporaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15one piece of code is responsible for the lifetime of every aggregateJohn McCall
slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21Rename LazyCleanup -> Cleanup. No functionality change for these last threeJohn McCall
commits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21Code simplification.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21Switch the main possibly-conditional temporary cleanup over to being lazy.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108995 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06Validated by nightly-test runs on x86 and x86-64 darwin, including afterJohn McCall
self-host. Hopefully these results hold up on different platforms. I tried to keep the GNU ObjC runtime happy, but it's hard for me to test. Reimplement how clang generates IR for exceptions. Instead of creating new invoke destinations which sequentially chain to the previous destination, push a more semantic representation of *why* we need the cleanup/catch/filter behavior, then collect that information into a single landing pad upon request. Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional control flow) are generated, since it's actually fairly closely tied in with the former. Remove the need to track which cleanup scope a block is associated with. Document a lot of previously poorly-understood (by me, at least) behavior. The new framework implements the Horrible Hack (tm), which requires every landing pad to have a catch-all so that inlining will work. Clang no longer requires the Horrible Hack just to make exceptions flow correctly within a function, however. The HH is an unfortunate requirement of LLVM's EH IR. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107631 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102882 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22Call PerformCopyInitialization to properly initialize the exception temporaryJohn McCall
in a throw expression. Use EmitAnyExprToMem to emit the throw expression, which magically elides the final copy-constructor call (which raises a new strict-compliance bug, but baby steps). Give __cxa_throw a destructor pointer if the exception type has a non-trivial destructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the ↵Anders Carlsson
temporaries code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24Fix double-destruction assertion to account for temporaries in conditionalsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24Assert that we aren't trying to push the same C++ temporary onto the live ↵Douglas Gregor
temporary stack twice. A little insurance against PR5867 surprising us again git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17Ensure we run cleanups for CXXTemporaries on the exceptional edge. WIP.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15ShouldDestroyTemporaries? I don't think so.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24Get rid of the ugly CGCXX names and replace them with CGClass, CGExprCXX and ↵Anders Carlsson
CGTemporaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89742 91177308-0d34-0410-b5e6-96231b3b80d8