[cfe-dev] Sometimes throwing constructors / destructors
Arnaud A. de Grandmaison
arnaud.degrandmaison at arm.com
Fri Jul 25 03:05:31 PDT 2014
Yes that's it. Thanks for the explanations !
Cheers,
Arnaud
-----Original Message-----
From: Dr D. Chisnall [mailto:dc552 at hermes.cam.ac.uk] On Behalf Of David
Chisnall
Sent: 25 July 2014 11:38
To: Arnaud De Grandmaison
Cc: Tim Northover; cfe-dev Developers
Subject: Re: [cfe-dev] Sometimes throwing constructors / destructors
On 25 Jul 2014, at 10:14, Arnaud A. de Grandmaison
<arnaud.degrandmaison at arm.com> wrote:
> I understand your point but what bothers me is that if the first
constructor call fails, I agree that there is no destructions to do, but the
fact that it failed should still be signalled (with a resume, not a ret) so
that I can be handled properly.
I think you misunderstand how exceptions work in LLVM IR. If a function
that is called (not invoked) throws an exception, then the unwinder will not
find a landing pad in the function and so will keep going. No code after
the call will be reached in the case that an exception is thrown. The
following are equivalent:
call @foo()
br label %1
and
invoke @foo() to label %1 unwind to label %2
: <label>%2
resume
The only difference is that, if an exception *is* thrown (and no optimisers
turned the second form into the first) then the first form will be faster at
run time because the personality function will not find a cleanup, call back
into the function, then be called back. The unwind tables and generated
code will also be smaller.
David
More information about the cfe-dev
mailing list