[PATCH] D143637: StackProtector: add unwind cleanup paths for instrumentation.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 04:34:50 PDT 2023


t.p.northover closed this revision.
t.p.northover added a comment.

Thanks, committed as 203b6f31bb71 <https://reviews.llvm.org/rG203b6f31bb71ce63488eb96b303e000e91aee376>.



================
Comment at: llvm/lib/CodeGen/DwarfEHPrepare.cpp:176
+  LandingPadInst *LP = BB.getLandingPadInst();
+  if (LP->isCleanup())
+    return;
----------------
xiangzhangllvm wrote:
> xiangzhangllvm wrote:
> > LGTM, just a question.
> > Do we will really generate a Landing Pad for try catch pairs without cleanup in real world ?
> > Should it report error earlier if without cleanup?
> > Anyway this patch enhance for them.
> > 
> Sorry, here only for personality function not visible try catch.
> Do we will really generate a Landing Pad for try catch pairs without cleanup in real world ?

Yes, cleanup is only used if there's some code that needs to be run regardless of whether an exception is caught (e.g. C++ destructors). So for example this leads to a landingpad without cleanup:

```
void func();
void foo() {
  try {
    func();
  } catch (int i) {
  }
}
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143637/new/

https://reviews.llvm.org/D143637



More information about the llvm-commits mailing list