summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGException.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Better framework for conditional cleanups; untested as yet.John McCall2011-01-261-0/+36
| | | | | | | | 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. llvm-svn: 124277
* "Name" a bool parameter.Anders Carlsson2011-01-241-3/+5
| | | | llvm-svn: 124094
* Fix a latent bug where, after emitting an expression statement, we wouldJohn McCall2011-01-121-8/+7
| | | | | | | | | | | | | | delete the block we began emitting into if it had no predecessors. We never want to do this, because there are several valid cases during statement emission where an existing block has no known predecessors but will acquire some later. The case in my test case doesn't inherently fall into this category, because we could safely emit the case-range code before the statement body, but there are examples with labels that can't be fallen into that would also demonstrate this bug. rdar://problem/8837067 llvm-svn: 123303
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-1/+1
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* ARM EH uses a different personality function in C.John McCall2010-11-071-0/+3
| | | | llvm-svn: 118366
* Don't assert on attempts to throw 'bool'. I wonder if in the history of C++John McCall2010-10-291-1/+1
| | | | | | anyone has ever intentionally done this outside of a compiler test case. llvm-svn: 117645
* Death to blocks, or at least the word "block" in one particular obnoxiouslyJohn McCall2010-10-151-1/+1
| | | | | | ambiguous context. llvm-svn: 116567
* Opportunistically use the C++ personality function in ObjC++John McCall2010-09-161-13/+93
| | | | | | translation units that don't catch ObjC types. rdar://problem/8434851 llvm-svn: 114070
* one piece of code is responsible for the lifetime of every aggregateJohn McCall2010-09-151-1/+1
| | | | | | | | | | | | | 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 llvm-svn: 113962
* IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument andDaniel Dunbar2010-08-211-1/+4
| | | | | | | | update callers as best I can. - This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement. - Serious review appreciated. llvm-svn: 111707
* Sketch out a framework for delaying the activation of a cleanup.John McCall2010-08-131-2/+4
| | | | | | Not yet complete or used. llvm-svn: 111044
* When re-raising an exception after a cleanup, we need to call ↵John McCall2010-08-111-1/+1
| | | | | | | | | | | | | | | | | | _Unwind_Resume_or_Rethrow instead of _Unwind_Resume. With SJLJ exceptions, this is spelled "_Unwind_SjLj_Resume_or_Rethrow", not "_Unwind_SjLj_Resume", which has significantly different semantics. We should actually never be generating a call to _Unwind_SjLj_Resume directly; even if we were generating true cleanups (which we aren't because of the horrible hack), we should be calling __cxa_end_cleanup() on ARM. I haven't implemented this because there's little point as long as the HH is present. I believe this fixes <rdar://problem/8281377>. llvm-svn: 110851
* Fix a bug in @finally emission in both the fragile and non-fragile EH schemesJohn McCall2010-08-111-0/+10
| | | | | | | | | where we weren't accounting for the possibility that a @finally block might have internal cleanups and therefore might write to the cleanup destination slot. Fixes <rdar://problem/8293901>. llvm-svn: 110760
* Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.John McCall2010-07-241-1/+7
| | | | | | Diagnose attempts to do this under the GNU or fragile NeXT runtimes. llvm-svn: 109298
* Revise cleanup IR generation to fix a major bug with cleanups (PR7686)John McCall2010-07-231-57/+68
| | | | | | | as well as some significant asymptotic inefficiencies with threading multiple jumps through deep cleanups. llvm-svn: 109274
* Rename LazyCleanup -> Cleanup. No functionality change for these last threeJohn McCall2010-07-211-36/+36
| | | | | | commits. llvm-svn: 109000
* Rip out EHCleanupScope.John McCall2010-07-211-45/+6
| | | | llvm-svn: 108999
* Kill the CleanupBlock API.John McCall2010-07-211-63/+0
| | | | llvm-svn: 108998
* Switch finally cleanups over to being lazy cleanups. We get basically nothingJohn McCall2010-07-211-46/+62
| | | | | | | from the laziness features here except better block ordering, but it removes yet another CleanupBlock use. llvm-svn: 108990
* Convert the end-catch call for finally blocks to a lazy cleanup. This kills offJohn McCall2010-07-211-13/+25
| | | | | | the last of the shared-code cleanups. llvm-svn: 108975
* Fix the IR generation for catching pointers by references.John McCall2010-07-201-2/+49
| | | | | | Fixes <rdar://problem/8212123>. llvm-svn: 108944
* The GNU-runtime ObjC personality function doesn't let us rethrow with URR forJohn McCall2010-07-171-43/+66
| | | | | | multiple reasons. Rethrow with _objc_exception_throw instead. Fixes PR7656. llvm-svn: 108595
* Work around an obnoxious GCC warning by changing semantics in a hopefully-John McCall2010-07-131-1/+3
| | | | | | harmless way. llvm-svn: 108295
* Switch the __cxa_rethrow cleanup to be lazy.John McCall2010-07-131-6/+12
| | | | llvm-svn: 108288
* Allow for the possibility that __cxa_end_catch might throw for a catch-all blockJohn McCall2010-07-131-13/+43
| | | | | | | or a catch of a record type by value or reference. Also convert this to a lazy cleanup. llvm-svn: 108287
* Switch the __cxa_free_exception cleanup to be lazy.John McCall2010-07-131-16/+32
| | | | llvm-svn: 108276
* Teach IR generation how to lazily emit cleanups. This has a lot of advantages,John McCall2010-07-131-14/+69
| | | | | | | | | | | | | | | mostly in avoiding unnecessary work at compile time but also in producing more sensible block orderings. Move the destructor cleanups for local variables over to use lazy cleanups. Eventually all cleanups will do this; for now we have some awkward code duplication. Tell IR generation just to never produce landing pads in -fno-exceptions. This is a much more comprehensive solution to a problem which previously was half-solved by checks in most cleanup-generation spots. llvm-svn: 108270
* Teach function-try-blocks on constructors and destructors to implicitlyJohn McCall2010-07-071-8/+18
| | | | | | rethrow. Fixes rdar://problem/7696603 llvm-svn: 107757
* Validated by nightly-test runs on x86 and x86-64 darwin, including afterJohn McCall2010-07-061-409/+1084
| | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 107631
* Remove unnecessary ASTContext parameter fromDouglas Gregor2010-07-011-1/+1
| | | | | | CXXRecordDecl::getDestructor(); no functionality change. llvm-svn: 107394
* finally get around to doing a significant cleanup to irgen:Chris Lattner2010-06-271-7/+4
| | | | | | | | have CGF create and make accessible standard int32,int64 and intptr types. This fixes a ton of 80 column violations introduced by LLVMContextification and cleans up stuff a lot. llvm-svn: 106977
* Fix personality function name when using SjLj exceptions.Daniel Dunbar2010-05-281-2/+5
| | | | llvm-svn: 104999
* Fix an ambiguous else warning from GCC by adding some much needed curlies.Chandler Carruth2010-05-171-2/+3
| | | | llvm-svn: 103972
* Pick the correct personality function based on the language. This prevents ↵David Chisnall2010-05-171-25/+26
| | | | | | | | link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function). This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass. The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future. llvm-svn: 103938
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-161-11/+11
| | | | | | | | | | | | | __cxa_guard_abort along the exceptional edge into (in effect) a nested "try" that rethrows after aborting. Fixes PR7144 and the remaining Boost.ProgramOptions failures, along with the regressions that r103880 caused. The crucial difference between this and r103880 is that we now follow LLVM's little dance with the llvm.eh.exception and llvm.eh.selector calls, then use _Unwind_Resume_or_Rethrow to rethrow. llvm-svn: 103892
* Revert r103880 (thread-safe static initialization w/ exceptions),Douglas Gregor2010-05-161-16/+11
| | | | | | because it's causing strange linker errors. Unfixes PR7144. llvm-svn: 103890
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-151-11/+16
| | | | | | | | __cxa_guard_abort along the exceptional edge into (in effect) a nested "try" that rethrows after aborting. Fixes PR7144 and the remaining Boost.ProgramOptions failures. llvm-svn: 103880
* Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTIJohn McCall2010-04-301-3/+3
| | | | | | when used by the exceptions routines. Fixes PR 6974. llvm-svn: 102684
* Teach EHCleanupBlock to deal appropriately with the possibility that thereJohn McCall2010-04-301-1/+5
| | | | | | might not have been an insertion block set at start. Fixes PR6975. llvm-svn: 102677
* Call PerformCopyInitialization to properly initialize the exception temporaryJohn McCall2010-04-221-82/+78
| | | | | | | | | 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. llvm-svn: 102039
* Miscellaneous codegen cleanups. Mostly, don't create new basic blocksJohn McCall2010-04-211-30/+35
| | | | | | | just to save the current insertion state! This change significantly simplifies the IR CFG in exceptions code. llvm-svn: 101996
* Replace some SmallVectors with arrays.Benjamin Kramer2010-03-181-21/+13
| | | | llvm-svn: 98833
* More refactoring around constructor/destructor code generation.John McCall2010-02-191-45/+23
| | | | | | | | | | | | Fix some bugs with function-try-blocks and simplify normal try-block code generation. This implementation excludes a deleting destructor's call to operator delete() from the function-try-block, which I believe is correct but which I can't find straightforward support for at a moment's glance. llvm-svn: 96670
* Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixesDaniel Dunbar2010-02-101-5/+1
| | | | | | | calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling, for Darwin ARM. llvm-svn: 95787
* Make sure to set vtable pointers in the destructors as well.Anders Carlsson2010-02-071-0/+1
| | | | llvm-svn: 95525
* Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are ↵Anders Carlsson2010-02-061-0/+6
| | | | | | disabled. llvm-svn: 95509
* Standardize the parsing of function type attributes in a way thatJohn McCall2010-02-051-6/+7
| | | | | | | | | | | | follows (as conservatively as possible) gcc's current behavior: attributes written on return types that don't apply there are applied to the function instead, etc. Only parse CC attributes as type attributes, not as decl attributes; don't accepet noreturn as a decl attribute on ValueDecls, either (it still needs to apply to other decls, like blocks). Consistently consume CC/noreturn information throughout codegen; enforce this by removing their default values in CodeGenTypes::getFunctionInfo(). llvm-svn: 95436
* Fix last patch, catch of reference to non-pointer.Mike Stump2010-01-011-10/+12
| | | | llvm-svn: 92386
* Fix catching a reference to a pointer.Mike Stump2010-01-011-3/+15
| | | | llvm-svn: 92385
* Pass ReturnValueSlot to EmitCall. No functionality change yet.Anders Carlsson2009-12-241-2/+2
| | | | llvm-svn: 92138
OpenPOWER on IntegriCloud