John McCall
9dffe6f51c
Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI
...
when used by the exceptions routines. Fixes PR 6974.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 01:15:21 +00:00
John McCall
891f80ec2f
Teach EHCleanupBlock to deal appropriately with the possibility that there
...
might not have been an insertion block set at start. Fixes PR6975.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102677 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 00:06:43 +00:00
John McCall
ac41816269
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 01:10:34 +00:00
John McCall
3d3ec1c099
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 10:05:39 +00:00
Benjamin Kramer
7c647a1270
Replace some SmallVectors with arrays.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 16:59:57 +00:00
John McCall
9fc6a77746
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96670 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 09:25:03 +00:00
Daniel Dunbar
b2987d159a
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95787 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 18:49:11 +00:00
Anders Carlsson
1851a12605
Make sure to set vtable pointers in the destructors as well.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95525 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-07 19:45:40 +00:00
Anders Carlsson
a994ee4b19
Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are disabled.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95509 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 23:59:05 +00:00
John McCall
04a67a6aa3
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().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 21:31:56 +00:00
Mike Stump
13b2f92184
Fix last patch, catch of reference to non-pointer.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 03:20:32 +00:00
Mike Stump
b606c38468
Fix catching a reference to a pointer.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 02:51:52 +00:00
Anders Carlsson
f3c47c9525
Pass ReturnValueSlot to EmitCall. No functionality change yet.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 19:25:24 +00:00
Mike Stump
63df2ae96b
Cleanup some dead code.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 06:52:05 +00:00
Douglas Gregor
154fe9812f
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92064 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 22:04:40 +00:00
Anders Carlsson
1d7088d1d9
Rename GetAddrOfRTTI to GetAddrOfRTTIDescriptor. Remove the overload that takes a CXXRecordDecl since we were just creating a QualType from it anyway.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 07:09:17 +00:00
Mike Stump
f2945c0a74
Ensure we run cleanups for CXXTemporaries on the exceptional edge. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 06:08:47 +00:00
Anders Carlsson
e8e4a1c0bf
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 07:05:41 +00:00
Chandler Carruth
60cfcecaf4
Silence some release build warnings.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 01:37:04 +00:00
Jeffrey Yasskin
9f61aa9e28
Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gave
...
no extra safety anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12 05:05:38 +00:00
Anders Carlsson
8370c58b92
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 00:32:37 +00:00
Mike Stump
0924a8a06f
Fix spacing.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 00:02:10 +00:00
Mike Stump
5030a98e20
Setup cleanup on eh edge out of the construction of the cleanup object
...
during throw to deallocate the exception object. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 01:52:30 +00:00
Mike Stump
8755ec3361
Fixup spacing.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 00:06:18 +00:00
Mike Stump
182f383db1
Ensure we only generate one terminate handler.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 00:02:42 +00:00
Mike Stump
23e17c81d5
Remove obsolete FIXME and some dead fallback code.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 23:52:09 +00:00
Mike Stump
7695809982
Add terminate handler for copy constructors for thrown objects. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90994 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 23:31:35 +00:00
Mike Stump
9b39c51ae3
Break out code for reuse. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 22:59:31 +00:00
Mike Stump
d88ea56879
Add cleanups for exceptional edges. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 03:35:49 +00:00
Mike Stump
4e0179f030
Add fixme.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 22:12:48 +00:00
Mike Stump
e64d434a34
Remove some old code. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 21:46:41 +00:00
Mike Stump
b2debeb96d
Fixup catch parameters with class reference type. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 01:29:31 +00:00
Mike Stump
cce3d4f981
Add codegen support for exception specifications. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 23:38:24 +00:00
Mike Stump
c2ab486980
Work around emitters that can't deal with dead code contexts yet.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 20:12:14 +00:00
Mike Stump
6a1e0eb557
Add support for function try blocks.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90622 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 23:26:17 +00:00
Mike Stump
b2c9c0b1c5
Fixup nested try blocks.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 19:21:57 +00:00
Mike Stump
a086783570
Fix warning and be sure to set up the rethrow pointer if we fall off
...
the end of all the catches.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 19:03:47 +00:00
Mike Stump
fffefeb8ec
Try/catch statements seem to be working well enough to turn on.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90538 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 03:57:07 +00:00
Mike Stump
ce0339032a
Disable for now, doesn't play nice with the temporary code.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 03:55:53 +00:00
Mike Stump
0a3816e566
Fixup reference binding for catch parameters.
...
Fixup throws and rethrows to use invoke as appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90513 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 01:51:45 +00:00
Mike Stump
3faae56c3b
These are done.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90494 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 22:55:42 +00:00
Mike Stump
d9cb7e9732
Improve catch parameter bindings for scalar non-pointers. WIP.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 22:38:15 +00:00
Mike Stump
f668bd0e05
Reflow.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 03:40:14 +00:00
Mike Stump
6b85fa4121
Remove untrue statement.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 01:34:13 +00:00
Mike Stump
be7c144fcb
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 23:46:02 +00:00
Mike Stump
f7f74675d4
Add a cleanup scope for each catch clause.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 23:37:16 +00:00
Mike Stump
639787c8e9
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 19:53:57 +00:00
Mike Stump
de05057932
Change rtti/Rtti to RTTI, as it is an acronym.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 18:57:08 +00:00
Mike Stump
c88b6735ea
Avoid warning for getTerminateFn defined but not used.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 18:20:18 +00:00
Mike Stump
666571afad
terminate doesn't throw.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90308 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 08:18:09 +00:00