[clang] [clang][CodeGen] Added SanitizerHandler mapping, trap messages in debug info, and corresponding test cases. (PR #143758)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 13 13:57:29 PDT 2025
================
@@ -4051,6 +4144,14 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
+ llvm::DILocation *TrapLocation = Builder.getCurrentDebugLocation();
+ llvm::StringRef Category = GetTrapMessageForHandler(CheckHandlerID);
+
+ if (getDebugInfo() && !Category.empty()) {
+ TrapLocation = getDebugInfo()->CreateTrapFailureMessageFor(
+ TrapLocation, Category, TrapMessage);
----------------
anthonyhatran wrote:
Yes, you are correct on that. I didn't initially intend on having the `TrapMessage `part there at all until I examined `CreateTrapFailureMessageFor `which required it, which was why I left it like so. I think a possible approach could be to put the `SanitizerHandler`'s name as the category, and have the `GetTrapMessageForHandler `deal with the `TrapMessage`, but let me know if it would be preferable to have it more general with "`UBSan Trap`" instead
https://github.com/llvm/llvm-project/pull/143758
More information about the cfe-commits
mailing list