[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


================
@@ -85,6 +85,92 @@ enum VariableTypeDescriptorKind : uint16_t {
 //                        Miscellaneous Helper Methods
 //===--------------------------------------------------------------------===//
 
+static llvm::StringRef GetTrapMessageForHandler(SanitizerHandler ID) {
+  switch (ID) {
+  case SanitizerHandler::AddOverflow:
+    return "Signed integer addition overflowed.";
+
+  case SanitizerHandler::BuiltinUnreachable:
+    return "_builtin_unreachable() executed.";
----------------
delcypher wrote:

Nit. We probably should omit the `.` at the end of the strings. Clang diagnostics tend to do this so we should probably follow think convention unless we have a good reason to not to do this. I realize these aren't  the same thing as clang diagnostics so maybe the best thing to do is see how these render in LLDB and decide if they should end with a `.` and then do this consistently.

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


More information about the cfe-commits mailing list