Daniel Dunbar
51c3387b5e
Fix personality function name when using SjLj exceptions.
...
llvm-svn: 104999
2010-05-28 19:43:36 +00:00
Chandler Carruth
0450cc684c
Fix an ambiguous else warning from GCC by adding some much needed curlies.
...
llvm-svn: 103972
2010-05-17 20:58:49 +00:00
David Chisnall
f9c4225af6
Pick the correct personality function based on the language. This prevents 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
2010-05-17 13:49:20 +00:00
Douglas Gregor
51150ab1f1
When initializing thread-safe statics, put the call to
...
__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
2010-05-16 01:24:12 +00:00
Douglas Gregor
c278d1b3b9
Revert r103880 (thread-safe static initialization w/ exceptions),
...
because it's causing strange linker errors. Unfixes PR7144.
llvm-svn: 103890
2010-05-16 00:44:00 +00:00
Douglas Gregor
58142dd8a1
When initializing thread-safe statics, put the call to
...
__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
2010-05-15 17:55:51 +00:00
John McCall
48bf349471
Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI
...
when used by the exceptions routines. Fixes PR 6974.
llvm-svn: 102684
2010-04-30 01:15:21 +00:00
John McCall
dac3ea6e8d
Teach EHCleanupBlock to deal appropriately with the possibility that there
...
might not have been an insertion block set at start. Fixes PR6975.
llvm-svn: 102677
2010-04-30 00:06:43 +00:00
John McCall
2e6567ae60
Call PerformCopyInitialization to properly initialize the exception temporary
...
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
2010-04-22 01:10:34 +00:00
John McCall
2188696d98
Miscellaneous codegen cleanups. Mostly, don't create new basic blocks
...
just to save the current insertion state! This change significantly
simplifies the IR CFG in exceptions code.
llvm-svn: 101996
2010-04-21 10:05:39 +00:00
Benjamin Kramer
966e934b34
Replace some SmallVectors with arrays.
...
llvm-svn: 98833
2010-03-18 16:59:57 +00:00
John McCall
b81884d347
More refactoring around constructor/destructor code generation.
...
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
2010-02-19 09:25:03 +00:00
Daniel Dunbar
3241d400c8
Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
...
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.
llvm-svn: 95787
2010-02-10 18:49:11 +00:00
Anders Carlsson
ff8cce4395
Make sure to set vtable pointers in the destructors as well.
...
llvm-svn: 95525
2010-02-07 19:45:40 +00:00
Anders Carlsson
9878f9f73b
Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are disabled.
...
llvm-svn: 95509
2010-02-06 23:59:05 +00:00
John McCall
ab26cfa58d
Standardize the parsing of function type attributes in a way that
...
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
2010-02-05 21:31:56 +00:00
Mike Stump
9d44fdb397
Fix last patch, catch of reference to non-pointer.
...
llvm-svn: 92386
2010-01-01 03:20:32 +00:00
Mike Stump
5ee041873b
Fix catching a reference to a pointer.
...
llvm-svn: 92385
2010-01-01 02:51:52 +00:00
Anders Carlsson
61a401caec
Pass ReturnValueSlot to EmitCall. No functionality change yet.
...
llvm-svn: 92138
2009-12-24 19:25:24 +00:00
Mike Stump
4a779b93e4
Cleanup some dead code.
...
llvm-svn: 92122
2009-12-24 06:52:05 +00:00
Douglas Gregor
247894b361
There is no such thing as typeinfo for a cv-qualified type. Assert
...
that this is true when mangling, then fix up the various places in
Sema and/or CodeGen that need to remove qualifiers. Addresses a
linking issue when building LLVM with Clang.
llvm-svn: 92064
2009-12-23 22:04:40 +00:00
Anders Carlsson
3f4336cb1f
Rename GetAddrOfRTTI to GetAddrOfRTTIDescriptor. Remove the overload that takes a CXXRecordDecl since we were just creating a QualType from it anyway.
...
llvm-svn: 91590
2009-12-17 07:09:17 +00:00
Mike Stump
cd8faeb0b1
Ensure we run cleanups for CXXTemporaries on the exceptional edge. WIP.
...
llvm-svn: 91588
2009-12-17 06:08:47 +00:00
Anders Carlsson
07863b8b6e
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
...
llvm-svn: 91520
2009-12-16 07:05:41 +00:00
Chandler Carruth
8abbc657a9
Silence some release build warnings.
...
llvm-svn: 91234
2009-12-13 01:37:04 +00:00
Jeffrey Yasskin
1615d45daa
Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gave
...
no extra safety anyway.
llvm-svn: 91207
2009-12-12 05:05:38 +00:00
Anders Carlsson
afd1edb52e
When an exception needs to be freed by calling __cxa_exception_free, make sure to stash away the exception pointer somewhere.
...
This fixes an "Instruction does not dominate all uses!" verification error when compiling TableGen.
llvm-svn: 91084
2009-12-11 00:32:37 +00:00
Mike Stump
37077bf651
Fix spacing.
...
llvm-svn: 91078
2009-12-11 00:02:10 +00:00
Mike Stump
3c6a12ca65
Setup cleanup on eh edge out of the construction of the cleanup object
...
during throw to deallocate the exception object. WIP.
llvm-svn: 91035
2009-12-10 01:52:30 +00:00
Mike Stump
75546b8c88
Fixup spacing.
...
llvm-svn: 91001
2009-12-10 00:06:18 +00:00
Mike Stump
f5cbb08c4b
Ensure we only generate one terminate handler.
...
llvm-svn: 90998
2009-12-10 00:02:42 +00:00
Mike Stump
3b60f034f9
Remove obsolete FIXME and some dead fallback code.
...
llvm-svn: 90997
2009-12-09 23:52:09 +00:00
Mike Stump
25b20fc2ae
Add terminate handler for copy constructors for thrown objects. WIP.
...
llvm-svn: 90994
2009-12-09 23:31:35 +00:00
Mike Stump
2b488873bf
Break out code for reuse. WIP.
...
llvm-svn: 90991
2009-12-09 22:59:31 +00:00
Mike Stump
aff69af918
Add cleanups for exceptional edges. WIP.
...
llvm-svn: 90940
2009-12-09 03:35:49 +00:00
Mike Stump
4a6b337cfd
Add fixme.
...
llvm-svn: 90884
2009-12-08 22:12:48 +00:00
Mike Stump
e6d54ca553
Remove some old code. WIP.
...
llvm-svn: 90882
2009-12-08 21:46:41 +00:00
Mike Stump
02c23d68cb
Fixup catch parameters with class reference type. WIP.
...
llvm-svn: 90821
2009-12-08 01:29:31 +00:00
Mike Stump
1d849219a5
Add codegen support for exception specifications. WIP.
...
llvm-svn: 90817
2009-12-07 23:38:24 +00:00
Mike Stump
62afe99814
Work around emitters that can't deal with dead code contexts yet.
...
llvm-svn: 90796
2009-12-07 20:12:14 +00:00
Mike Stump
bee78dd31b
Add support for function try blocks.
...
llvm-svn: 90622
2009-12-04 23:26:17 +00:00
Mike Stump
875912ac13
Fixup nested try blocks.
...
llvm-svn: 90576
2009-12-04 19:21:57 +00:00
Mike Stump
5c820758f5
Fix warning and be sure to set up the rethrow pointer if we fall off
...
the end of all the catches.
llvm-svn: 90574
2009-12-04 19:03:47 +00:00
Mike Stump
8c1253b4c2
Try/catch statements seem to be working well enough to turn on.
...
llvm-svn: 90538
2009-12-04 03:57:07 +00:00
Mike Stump
2ab55765f7
Disable for now, doesn't play nice with the temporary code.
...
llvm-svn: 90537
2009-12-04 03:55:53 +00:00
Mike Stump
114ab9f695
Fixup reference binding for catch parameters.
...
Fixup throws and rethrows to use invoke as appropriate.
llvm-svn: 90513
2009-12-04 01:51:45 +00:00
Mike Stump
5f141b75f9
These are done.
...
llvm-svn: 90494
2009-12-03 22:55:42 +00:00
Mike Stump
7398ff0f07
Improve catch parameter bindings for scalar non-pointers. WIP.
...
llvm-svn: 90492
2009-12-03 22:38:15 +00:00
Mike Stump
2842b4cf86
Reflow.
...
llvm-svn: 90407
2009-12-03 03:40:14 +00:00
Mike Stump
26ada867ba
Remove untrue statement.
...
llvm-svn: 90377
2009-12-03 01:34:13 +00:00
Mike Stump
2d52ce5f94
Cleanups on exceptional edges don't work at all, yet. This doesn't
...
catch very many of them and if we caught all of them, the errors would
be annoying. I'm working on this next. WIP.
llvm-svn: 90358
2009-12-02 23:46:02 +00:00
Mike Stump
90990965e0
Add a cleanup scope for each catch clause.
...
llvm-svn: 90357
2009-12-02 23:37:16 +00:00
Mike Stump
9732915bf9
Pull the terminate handler up so that we can use it for the catch
...
parameter setup code and set up the catch parameter setup code to
protect that code with terminate.
llvm-svn: 90340
2009-12-02 19:53:57 +00:00
Mike Stump
c01c2b87e8
Change rtti/Rtti to RTTI, as it is an acronym.
...
llvm-svn: 90334
2009-12-02 18:57:08 +00:00
Mike Stump
a9a590cd12
Avoid warning for getTerminateFn defined but not used.
...
llvm-svn: 90330
2009-12-02 18:20:18 +00:00
Mike Stump
a510597ef9
terminate doesn't throw.
...
llvm-svn: 90308
2009-12-02 08:18:09 +00:00
Mike Stump
33270211a0
More exception handling improvements... WIP.
...
Highlights include:
Add a helper to generate __cxa_free_exception and _ZSt9terminatev.
Add a region to handle EH object deallocation for ctor failures for throw.
Add a terminate handler for __cxa_end_catch.
A framework for adding cleanup actions for the exceptional edges only.
llvm-svn: 90305
2009-12-02 07:41:41 +00:00
Mike Stump
5406614be9
Much work on try/catch statement. WIP.
...
Highlights include:
Fix __cxa_begin_catch so it now returns a value.
Added getUnwindResumeOrRethrowFn helper to build up calls to
_Unwind_Resume_or_Rethrow.
Broke out object copying code into CopyObject from EmitCXXThrowExpr.
Built up another version of CopyObject that can copy from memory for
use in the catch parameter code.
RTTI generation for type matching for catch.
Code to check for the type match for catch.
Code to generate the catch parameter, WIP, need make sure references
and pointers and copy ctors work.
llvm-svn: 90205
2009-12-01 03:41:18 +00:00
Mike Stump
58ef18b38c
Checkpoint current work. WIP.
...
llvm-svn: 89513
2009-11-20 23:44:51 +00:00
Mike Stump
d8d26d06a5
Implement throw d, where d is a class type that requires copy
...
construction. WIP.
llvm-svn: 89442
2009-11-20 02:31:07 +00:00
Mike Stump
4d7a07bdaf
Handle throw d, where d is a class type but only has a trivial copy
...
constructor. WIP.
llvm-svn: 89438
2009-11-20 01:57:39 +00:00
Mike Stump
d1782cc478
Add suport for throw;. WIP.
...
llvm-svn: 89424
2009-11-20 00:56:31 +00:00
Mike Stump
18fc44dfd3
Fix rtti generation for throws. WIP.
...
llvm-svn: 89420
2009-11-20 00:43:57 +00:00
Anders Carlsson
32e1b1c169
Get throws limping along, still a bunch of FIXMEs. Too bad we don't support catching anything yet :)
...
llvm-svn: 85574
2009-10-30 02:27:02 +00:00
Anders Carlsson
4b08db7a62
Add CGException.cpp, to be used for exception related code generation.
...
llvm-svn: 85560
2009-10-30 01:42:31 +00:00