[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:15 PDT 2025


================
@@ -0,0 +1,10 @@
+// RUN: %clang -O0 -g -debug-info-kind=standalone -dwarf-version=5 -fsanitize=undefined \
+// RUN: -fsanitize-trap=undefined -emit-llvm -S -c %s -o - | FileCheck %s
+
+int add_overflow(int a, int b) {
+  return a + b;
+}
+
+// CHECK: call void @llvm.ubsantrap(i8 0) {{.*}}!dbg [[LOC:![0-9]+]]
+// CHECK: [[LOC]] = !DILocation(line: 0, scope: [[MSG:![0-9]+]], {{.+}})
+// CHECK: distinct !DISubprogram(name: "__clang_trap_msg$UBSan Trap Reason
----------------
delcypher wrote:

These tests aren't matching the `DISubprogram` correctly. They are matching the category but they aren't matching the trap message. For example this test should be trying to match the `Signed integer addition overflowed` trap message.



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


More information about the cfe-commits mailing list