[PATCH] D137901: [Clang] `nothrow`-implying attributes should actually manifest `nothrow` attribute (PR58798)

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 13 18:16:44 PST 2022


MaskRay added a comment.

I think improving diagnostic is useful but `-fsanitize=` is probably not a good place. Instrumenting call sites with `callq   __ubsan_handle_exception_escape at PLT` wastes code size. The functionality is better handled somewhere in libc++abi personality related code with possible improvement to exception handling related LLVM IR.

  void bar(); void foo() { bar(); }

I wish that I capture the compiler and runtime behavior well in https://maskray.me/blog/2020-12-12-c++-exception-handling-abi#compiler-behavior. https://discourse.llvm.org/t/catching-exceptions-while-unwinding-through-fno-exceptions-code/57151 is a proposal to improve the diagnostics.

`clang++ -fno-exceptions -fsanitize=exception-escape -c b.cc` does not instrument the potentially-throwing-and-propagating `bar()` so an error cannot be caught.
However, for `-fno-exceptions` code, instrumenting every call site is going to greatly increase code size and suppress optimizations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137901



More information about the cfe-commits mailing list