[llvm] [FileCheck] Fix parsing empty global and pseudo variable names (PR #82595)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 14:14:07 PST 2024


================
@@ -0,0 +1,32 @@
+a
+
+; RUN: not FileCheck -input-file %s %s 2>&1 | \
+; RUN:   FileCheck -check-prefix CHECK-ERROR -DDIR=%S \
+; RUN:   --match-full-lines --strict-whitespace %s
+
+; CHECK:        a[[]]
+; CHECK-ERROR:[[DIR]]/empty-variable-name.txt:7:13: error: empty variable name
+; CHECK-ERROR-NEXT:; CHECK: a{{\[\[\]\]}}
+; CHECK-ERROR-NEXT:            ^
+
+b
+
+; RUN: not FileCheck -input-file %s -check-prefix CHECK-PSEUDO %s 2>&1 | \
+; RUN:   FileCheck -check-prefix CHECK-ERROR-PSEUDO -DDIR=%S \
+; RUN:   --match-full-lines --strict-whitespace %s
+
+; CHECK-PSEUDO: b[[@]]
+; CHECK-ERROR-PSEUDO:[[DIR]]/empty-variable-name.txt:18:20: error: empty pseudo variable name
+; CHECK-ERROR-PSEUDO-NEXT:; CHECK-PSEUDO: b{{\[\[@\]\]}}
+; CHECK-ERROR-PSEUDO-NEXT:                   ^
----------------
kovdan01 wrote:

Fixed, thanks, see 6974c787759218651f04a67c6e4bc5de76d80999. Also used `Str.slice(I, StringRef::npos)` to point to `]` instead of `@`.

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


More information about the llvm-commits mailing list