[llvm] [MC][Support] Track macro definition locations for improved diagnostics (PR #198936)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 13 13:30:14 PDT 2026


================
@@ -1,19 +1,42 @@
 # RUN: not llvm-mc -triple x86_64 %s -o /dev/null 2>&1 | FileCheck %s --match-full-lines --strict-whitespace
 
-#      CHECK:<instantiation>:1:1: error: unknown directive
-# CHECK-NEXT:.macrobody0
-# CHECK-NEXT:^
-# CHECK-NEXT:<instantiation>:1:1: note: while in macro instantiation
-# CHECK-NEXT:.test0
-# CHECK-NEXT:^
-# CHECK-NEXT:{{.*}}.s:[[#@LINE+10]]:1: note: while in macro instantiation
-# CHECK-NEXT:.test1
-# CHECK-NEXT:^
+## This test verifies that:
+## * Macro instantiation notes point directly to the `.macro` signature line itself
+##   (e.g. `.macro .test1` instead of the first statement of the macro body).
+## * Nested active macro instantiation stacks unwind cleanly.
+## * Column numbers and caret alignments inside `<instantiation>` virtual buffers
+##   are reported correctly (e.g. matching `.macrobody0` at column 7 on line 2).
+
+
+#      CHECK:<instantiation>:2:7: error: unknown directive
----------------
arichardson wrote:

And maybe the location of the macro definition as the error location? Otherwise it's kinda hard to find where it came from? 

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


More information about the llvm-commits mailing list