[clang] Emit debug info with original source location for tokens from macros … (PR #163190)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 15 10:56:00 PDT 2025
================
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 %s -debug-info-kind=standalone -emit-llvm -o - | FileCheck %s
+
+#define GLOBAL(num) global##num
+#define DECL_GLOBAL(x) int x
+#define SAME_ORDER(x, y) x; y
+#define SWAP_ORDER(x,y) y; x
+
+// CHECK: DIGlobalVariable(name: "global",{{.*}} line: [[@LINE+4]]
+// CHECK: DIGlobalVariable({{.*}}line: [[@LINE+6]],{{.*}} type: [[TYPEID:![0-9]+]]
+SAME_ORDER(
+ int
+ GLOBAL // <- global
+ () = 42,
+ const char* s() {
+ return "1234567890";
+ }
+)
+// CHECK: DIGlobalVariable(name: "global3",{{.*}} line: [[@LINE+6]]
+// CHECK: DIGlobalVariable(name: "global2",{{.*}} line: [[@LINE+2]]
----------------
dwblaikie wrote:
Could these comments (including those elsewhere in the test) be moved closer (within the macro argument) to the relevant line - ideally immediately prior (so it's `@LINE+1`, or even in a trailing comment on the same line using `@LINE`)
https://github.com/llvm/llvm-project/pull/163190
More information about the cfe-commits
mailing list