[clang] [Clang][CodeGen] Emit “trap reasons” on UBSan traps (PR #145967)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 9 02:36:17 PDT 2025
================
@@ -4051,6 +4141,14 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
+ llvm::DILocation *TrapLocation = Builder.getCurrentDebugLocation();
+ llvm::StringRef TrapMessage = GetUBSanTrapForHandler(CheckHandlerID);
+
+ if (getDebugInfo() && !TrapMessage.empty()) {
+ TrapLocation = getDebugInfo()->CreateTrapFailureMessageFor(
----------------
Michael137 wrote:
Lets add an `assert (TrapLocation && "Artificial trap frame requires valid debug-info for its scope.")`
So if we run into the crash again this will be easier to spot
https://github.com/llvm/llvm-project/pull/145967
More information about the cfe-commits
mailing list