[PATCH] Outline cleanup handlers for native Windows C++ exception handling
Reid Kleckner
rnk at google.com
Tue Feb 24 13:32:29 PST 2015
lgtm
REPOSITORY
rL LLVM
================
Comment at: lib/CodeGen/WinEHPrepare.cpp:288-292
@@ +287,7 @@
+ // cleanup. That will happen after the block analysis is in place.
+ if (LPad->isCleanup()) {
+ CallInst *EHAlloc = nullptr;
+ AllocaInst *IgnoreEHObjPtr = nullptr;
+ bool Outlined = outlineHandler(Cleanup, &F, nullptr, LPad, EHAlloc,
+ IgnoreEHObjPtr, FrameVarInfo);
+ if (Outlined) {
----------------
andrew.w.kaylor wrote:
> rnk wrote:
> > I'm not sure we can handle catches inside cleanups this way. Are you planning to switch to a more up front analysis in subsequent changes? I'm thinking of this case:
> > void g();
> > struct MyRAII { ~MyRAII(); };
> > void runs_before_dtor();
> > void f() {
> > MyRAII x;
> > try { g(); }
> > catch (int) { runs_before_dtor(); }
> > }
> >
> > We need to make sure runs_before_dtor() runs first, but I guess we haven't gotten to building eh.actions.
> Yeah, this only handles a single cleanup per landing pad and doesn't handle the case where a block of cleanup code is shared between landing pads. This is basically here as a place holder to move things along. I can add a comment explaining that.
>
> To handle cases like the one you describe I need the block analysis stuff in place. The actually outlining works the same way except that it gets a specific starting block and has different termination conditions. I have that working in my sandbox, but it seemed like a bit much to put into this review.
OK, sounds good.
http://reviews.llvm.org/D7865
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list