[PATCH] D98088: [FileCheck] Fix redundant diagnostics due to numeric errors

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 7 12:33:03 PST 2021


jdenny updated this revision to Diff 328892.
jdenny added a comment.

Rebased for changes to D98086 <https://reviews.llvm.org/D98086>.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98088/new/

https://reviews.llvm.org/D98088

Files:
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/test/FileCheck/match-time-error-propagation/invalid-excluded-pattern.txt
  llvm/test/FileCheck/match-time-error-propagation/invalid-expected-pattern.txt


Index: llvm/test/FileCheck/match-time-error-propagation/invalid-expected-pattern.txt
===================================================================
--- llvm/test/FileCheck/match-time-error-propagation/invalid-expected-pattern.txt
+++ llvm/test/FileCheck/match-time-error-propagation/invalid-expected-pattern.txt
@@ -1,9 +1,5 @@
 ; Check handling of match-time diagnostics for invalid patterns (e.g.,
 ; substitution overflow) in the case of expected patterns (e.g., CHECK).
-;
-; FIXME: We shouldn't have: (1) the blank note at the end of the trace, and
-; (2) the redundant error in the middle of the dump.  These will be fixed in a
-; subsequent patch.
 
 RUN: echo > %t.chk \
 RUN:      'CHECK: [[#0x8000000000000000+0x8000000000000000]] [[UNDEF-VAR]]'
@@ -13,9 +9,6 @@
       ERR:{{.*}}: error: unable to substitute variable or numeric expression: overflow error
  ERR-NEXT:CHECK: {{.*}}
  ERR-NEXT:{{ *}}^
- ERR-NEXT:{{.*}}: note: 
- ERR-NEXT:10000000000000000
- ERR-NEXT:^
  ERR-NEXT:<stdin>:1:1: note: uses undefined variable(s): "UNDEF"
  ERR-NEXT:10000000000000000
  ERR-NEXT:^
@@ -25,8 +18,7 @@
 DUMP-NEXT:           1: 10000000000000000 
 DUMP-NEXT:check:1'0     X~~~~~~~~~~~~~~~~~ error: match failed for invalid pattern
 DUMP-NEXT:check:1'1                        unable to substitute variable or numeric expression: overflow error
-DUMP-NEXT:check:1'2     X                  error: match failed for invalid pattern
-DUMP-NEXT:check:1'3                        uses undefined variable(s): "UNDEF"
+DUMP-NEXT:check:1'2                        uses undefined variable(s): "UNDEF"
 DUMP-NEXT:>>>>>>
 
 ;--------------------------------------------------
Index: llvm/test/FileCheck/match-time-error-propagation/invalid-excluded-pattern.txt
===================================================================
--- llvm/test/FileCheck/match-time-error-propagation/invalid-excluded-pattern.txt
+++ llvm/test/FileCheck/match-time-error-propagation/invalid-excluded-pattern.txt
@@ -4,10 +4,6 @@
 ; At one time, FileCheck's exit status was zero for this case.  Moreover, it
 ; printed the error diagnostic only if -vv was specified and input dumps were
 ; disabled.  Test every combination as the logic is hard to get right.
-;
-; FIXME: We shouldn't have: (1) the blank note at the end of the trace, and
-; (2) the redundant error in the middle of the dump.  These will be fixed in a
-; subsequent patch.
 
 RUN: echo > %t.chk \
 RUN:      'CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]] [[UNDEF-VAR]]'
@@ -24,9 +20,6 @@
          ERR:{{.*}}: error: unable to substitute variable or numeric expression: overflow error
     ERR-NEXT:CHECK-NOT: {{.*}}
     ERR-NEXT:{{ *}}^
-    ERR-NEXT:{{.*}}: note: 
-    ERR-NEXT:10000000000000000
-    ERR-NEXT:^
     ERR-NEXT:<stdin>:1:1: note: uses undefined variable(s): "UNDEF"
     ERR-NEXT:10000000000000000
     ERR-NEXT:^
@@ -36,8 +29,7 @@
    DUMP-NEXT:         1: 10000000000000000 
    DUMP-NEXT:not:1'0     X~~~~~~~~~~~~~~~~~ error: match failed for invalid pattern
    DUMP-NEXT:not:1'1                        unable to substitute variable or numeric expression: overflow error
-   DUMP-NEXT:not:1'2     X                  error: match failed for invalid pattern
-   DUMP-NEXT:not:1'3                        uses undefined variable(s): "UNDEF"
+   DUMP-NEXT:not:1'2                        uses undefined variable(s): "UNDEF"
 DUMP-VV-NEXT:         2: 
 DUMP-VV-NEXT:eof:1       ^
    DUMP-NEXT:>>>>>>
Index: llvm/lib/FileCheck/FileCheck.cpp
===================================================================
--- llvm/lib/FileCheck/FileCheck.cpp
+++ llvm/lib/FileCheck/FileCheck.cpp
@@ -1334,6 +1334,8 @@
               OS << " ";
               E.log(OS);
             });
+        if (!OS.tell())
+          continue;
       } else {
         // Substitution succeeded. Print substituted value.
         OS << "with \"";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98088.328892.patch
Type: text/x-patch
Size: 3885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210307/ebc5ad9b/attachment.bin>


More information about the llvm-commits mailing list