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

Anthony Tran via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 16:03:34 PDT 2025


================
@@ -0,0 +1,22 @@
+// FIXME: Currently, a nullptr check is in place before emitting a UBSan trap reason inside 
+// CodeGenFunction::EmitTrapCheck. This is disadvantageous because we may not emit a trap 
+// message in all cases where a trap message should be emitted. The check was added to prevent
+// a crash caused by a call to EmitTypeCheck in CodeGenFunction::StartFunction. The TypeMismatch 
+// handler is triggered and tries to attach itself to the debug-info location, but StartFunction 
+// only sets the debug-info location after the prologue code-gen is done resulting in a crash.
----------------
anthonyhatran wrote:

Rephrased

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


More information about the cfe-commits mailing list