[llvm] [TableGen] Print record location when record asserts fail (PR #111029)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 11:20:45 PDT 2024


================
@@ -118,32 +124,39 @@ def Rec20 : Person<"Donald Knuth", 60>;
 
 // CHECK: assertion failed
 // CHECK: note: person name is too long
-
+// CHECK: [[FILE]]:[[@LINE+1]]:5: error: assertion failed in this record
 def Rec21 : Person<"Donald Uh Oh This Name Is Too Long Knuth", 50>;
 
 // CHECK: assertion failed
 // CHECK: note: person age is invalid
-
+// CHECK: [[FILE]]:[[@LINE+1]]:5: error: assertion failed in this record
 def Rec22 : Person<"Donald Knuth", 150>;
 
 // Test the assert statement in an anonymous class invocation.
-
 def Rec30 {
   string Name = Person<"Margaret Heafield Hamilton", 25>.Name;
   int Age = Person<"Margaret Heafield Hamilton", 25>.Age;
 }
 
+// CHECK: assertion failed
+// CHECK: note: person name is too long
+// CHECK: [[FILE]]:[[@LINE+2]]:17: error: assertion failed in this record
----------------
jurahul wrote:

FYI, the location here printed in the line where the anonymous record was instantiated. This is due to my earlier commit to track anonymous record locations correctly.

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


More information about the llvm-commits mailing list