[cfe-dev] What's the difference between llvm `resume` instruction and `__cxa_rethrow`?

chuanqi.xcq via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 1 22:13:36 PST 2021


Oh, I got it now. Now there shouldn't be misunderstanding.

Many Thanks,
Chuanqi


------------------------------------------------------------------
From:John McCall <rjmccall at apple.com>
Send Time:2021年12月2日(星期四) 11:34
To:chuanqi.xcq <yedeng.yd at linux.alibaba.com>
Cc:James Y Knight <jyknight at google.com>; llvm-dev <llvm-dev at lists.llvm.org>; clang developer list <cfe-dev at lists.llvm.org>; "Fāng-ruì Sòng" <maskray at google.com>
Subject:Re: What's the difference between llvm `resume` instruction and `__cxa_rethrow`?

On 1 Dec 2021, at 22:00, chuanqi.xcq wrote:
> Hi John,
>
> Many thanks for your explanation of Exception Handling!
>
>>  So it depends on what’s in the ellipses, but I believe this code 
>> is invalid, and landing pads are not supposed to do a resume when 
>> they’ve said they’re going to catch.
>>
>> I assume the actual source code you’re processing doesn’t 
>> literally have a catch (...) { throw; }, and instead it calls some 
>> function that might do a throw;?
>
> I guess I didn't make things clear (or I misunderstood you). I think 
> the code I posted might be valid.

I mean that the generated IR is incorrect because, to correspond to that 
source code, it needs to be rethrowing within a catch body instead of 
simply resuming.  That’s what I thought you were asking about.

Frankly, I just assumed the structure of your generated coroutine body 
was correct, or correct enough to show the intent.

John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211202/12a390b7/attachment.html>


More information about the cfe-dev mailing list