[clang] [clang][CodeGen] Added SanitizerHandler mapping, trap messages in debug info, and corresponding test cases. (PR #143758)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 23 07:29:17 PDT 2025


================
@@ -4059,8 +4154,16 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
     auto Call = TrapBB->begin();
     assert(isa<llvm::CallInst>(Call) && "Expected call in trap BB");
 
-    Call->applyMergedLocation(Call->getDebugLoc(),
-                              Builder.getCurrentDebugLocation());
+    // Call->applyMergedLocation(Call->getDebugLoc(),
+    //                           Builder.getCurrentDebugLocation());
+    Call->applyMergedLocation(Call->getDebugLoc(), TrapLocation);
+
+    auto Unreachable = ++TrapBB->begin();
----------------
delcypher wrote:

Adjusting the debug info on the unreachable instructions is a bug fix in the Apple fork of Clang that I never got around to upstreaming. Is this something you needed for writing tests?

If this isn't strictly needed I'd suggest dropping this and you can add it as a separate patch.

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


More information about the cfe-commits mailing list