[clang] [Clang][CodeGen] Emit “trap reasons” on UBSan traps (PR #145967)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 24 16:52:55 PDT 2025


================
@@ -2595,6 +2595,16 @@ def fsanitize_undefined_trap_on_error
 def fno_sanitize_undefined_trap_on_error
     : Flag<["-"], "fno-sanitize-undefined-trap-on-error">, Group<f_clang_Group>,
       Alias<fno_sanitize_trap_EQ>, AliasArgs<["undefined"]>;
+defm sanitize_annotate_debug_info_traps
+    : BoolFOption<
+          "sanitize-annotate-debug-info-traps",
----------------
delcypher wrote:

So I suggested the name `-fsanitize-annotate-debug-info-traps`. The reason I picked that name was

* The feature annotates the debug info on traps. The proposed flag name describes this.
* The feature is very similar conceptually to `-fsanitize-annotate-debug-info` because that feature also annotates the debug info. We did consider different names but came to the conclusion that is potentially very confusing to have two different flags that both annotate the debug info but use completely different terminology for that in that flag name.

One alternative could be something like `-fsanitize-debug-trap-reasons`. So the name here doesn't really say anything about the implementation (annotating debug info) and more about what it tries to do, i.e. help with debugging the reason for trapping.

@thurstond Do you prefer `-fsanitize-debug-trap-reasons` or have another suggestion?


https://github.com/llvm/llvm-project/pull/145967


More information about the cfe-commits mailing list