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

92 Коммитов

Автор SHA1 Сообщение Дата
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