Граф коммитов

154 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson c1cfdf8647 Add a LangOptions::areExceptionsEnabled and start using it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126062 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20 00:20:27 +00:00
John McCall 56ca35d396 Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr.  This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait;  or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here.  In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some          
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125744 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17 10:25:35 +00:00
John McCall acff696118 Remove this FIXME; clear up an unused variable; style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125662 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 08:39:19 +00:00
John McCall e996ffd240 Save a copy expression for non-trivial copy constructions of catch variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125661 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 08:02:54 +00:00
John McCall d16c2cf1ca Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class.  Minor other refactorings.

Fixed a few address-space bugs while I was there.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 08:22:06 +00:00
John McCall 36f893c1ef Move all the cleanups framework code into a single file.
Pure motion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 11:13:47 +00:00
John McCall 3ad32c8d93 Convert the exception-freeing cleanup over to the conditional cleanups code,
fixing a crash which probably nobody was ever going to see.  In doing so,
fix a horrendous number of problems with the conditional-cleanups code.
Also, make conditional cleanups re-use the cleanup's activation variable,
which avoids some unfortunate repetitiveness.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124481 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 08:37:24 +00:00
John McCall 4bbcbda302 Fix some obvious bugs in the conditional-cleanup code and then make the
dtor cleanup use it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124309 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 19:15:39 +00:00
John McCall 150b462afc Better framework for conditional cleanups; untested as yet.
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
2011-01-26 04:00:11 +00:00
Anders Carlsson 82a113adf8 "Name" a bool parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124094 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24 01:59:49 +00:00
John McCall cd5b22e12b Fix a latent bug where, after emitting an expression statement, we would
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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123303 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 03:41:02 +00:00
John McCall 4765fa05b5 Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
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-12-06 08:20:24 +00:00
John McCall 4468078628 ARM EH uses a different personality function in C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118366 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-07 02:35:25 +00:00
John McCall 14e1bc9201 Don't assert on attempts to throw 'bool'. I wonder if in the history of C++
anyone has ever intentionally done this outside of a compiler test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117645 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 08:14:02 +00:00
John McCall b6bbcc9995 Death to blocks, or at least the word "block" in one particular obnoxiously
ambiguous context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116567 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 04:57:14 +00:00
John McCall b25938303d Opportunistically use the C++ personality function in ObjC++
translation units that don't catch ObjC types.  rdar://problem/8434851



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114070 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 06:16:50 +00:00
John McCall 558d2abc7f one piece of code is responsible for the lifetime of every aggregate
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-09-15 10:14:12 +00:00
Daniel Dunbar 91a16fa326 IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument and
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 02:24:36 +00:00
John McCall cd2d2b7814 Sketch out a framework for delaying the activation of a cleanup.
Not yet complete or used.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 21:20:51 +00:00
John McCall a5f2de2e49 When re-raising an exception after a cleanup, we need to call _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>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 20:59:53 +00:00
John McCall d96a8e771c Fix a bug in @finally emission in both the fragile and non-fragile EH schemes
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>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 00:16:14 +00:00
John McCall 5a18039787 Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.
Diagnose attempts to do this under the GNU or fragile NeXT runtimes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 00:37:23 +00:00
John McCall ff8e11579f Revise cleanup IR generation to fix a major bug with cleanups (PR7686)
as well as some significant asymptotic inefficiencies with threading
multiple jumps through deep cleanups.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 21:56:41 +00:00
John McCall 1f0fca5467 Rename LazyCleanup -> Cleanup. No functionality change for these last three
commits.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 07:22:38 +00:00
John McCall 7495f22934 Rip out EHCleanupScope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 07:11:21 +00:00
John McCall 6962f8d156 Kill the CleanupBlock API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108998 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 07:04:01 +00:00
John McCall 77199713ab Switch finally cleanups over to being lazy cleanups. We get basically nothing
from the laziness features here except better block ordering, but it removes yet
another CleanupBlock use.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 05:47:49 +00:00
John McCall 55b20fc514 Convert the end-catch call for finally blocks to a lazy cleanup. This kills off
the last of the shared-code cleanups.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108975 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 00:52:03 +00:00
John McCall 204b075fcc Fix the IR generation for catching pointers by references.
Fixes <rdar://problem/8212123>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 22:17:55 +00:00
John McCall 8262b6a44c The GNU-runtime ObjC personality function doesn't let us rethrow with URR for
multiple reasons.  Rethrow with _objc_exception_throw instead.  Fixes PR7656.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 00:43:08 +00:00
John McCall 3e29f96988 Work around an obnoxious GCC warning by changing semantics in a hopefully-
harmless way.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108295 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 23:19:49 +00:00
John McCall fcd5c0c62e Switch the __cxa_rethrow cleanup to be lazy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108288 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 22:24:23 +00:00
John McCall 8e3f861939 Allow for the possibility that __cxa_end_catch might throw for a catch-all block
or a catch of a record type by value or reference.  Also convert this to a
lazy cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108287 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 22:12:14 +00:00
John McCall 09faeabf39 Switch the __cxa_free_exception cleanup to be lazy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108276 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 21:17:51 +00:00
John McCall da65ea8648 Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 20:32:21 +00:00
John McCall 59a7000a79 Teach function-try-blocks on constructors and destructors to implicitly
rethrow.  Fixes rdar://problem/7696603



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107757 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 06:56:46 +00:00
John McCall f1549f66a8 Validated by nightly-test runs on x86 and x86-64 darwin, including after
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-07-06 01:34:17 +00:00
Douglas Gregor 1d110e05e0 Remove unnecessary ASTContext parameter from
CXXRecordDecl::getDestructor(); no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107394 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 14:13:13 +00:00
Chris Lattner 77b89b87c3 finally get around to doing a significant cleanup to irgen:
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106977 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-27 07:15:29 +00:00
Daniel Dunbar 8019c45024 Fix personality function name when using SjLj exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 19:43:36 +00:00
Chandler Carruth dcf22ad88f Fix an ambiguous else warning from GCC by adding some much needed curlies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 20:58:49 +00:00
David Chisnall 79a9ad8e5e 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103938 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 13:49:20 +00:00
Douglas Gregor 86a3a03667 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103892 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 01:24:12 +00:00
Douglas Gregor 1eb2e59338 Revert r103880 (thread-safe static initialization w/ exceptions),
because it's causing strange linker errors. Unfixes PR7144.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 00:44:00 +00:00
Douglas Gregor bfcc823a5c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103880 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 17:55:51 +00:00
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
Mike Stump 99533834ba 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 07:41:41 +00:00
Mike Stump 0f590be380 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90205 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 03:41:18 +00:00
Mike Stump 2bf701ee4b Checkpoint current work. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89513 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 23:44:51 +00:00
Mike Stump d1abf673bf Implement throw d, where d is a class type that requires copy
construction.  WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 02:31:07 +00:00
Mike Stump e36c9abd38 Handle throw d, where d is a class type but only has a trivial copy
constructor.  WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 01:57:39 +00:00