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

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 16:27:40 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf87b4109b267: [FileCheck] Fix redundant diagnostics due to numeric errors (authored by jdenny).

Repository:
  rG LLVM Github Monorepo

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]] [[UNDEFVAR]]'
@@ -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): "UNDEFVAR"
  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): "UNDEFVAR"
+DUMP-NEXT:check:1'2                        uses undefined variable(s): "UNDEFVAR"
 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]] [[UNDEFVAR]]'
@@ -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): "UNDEFVAR"
     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): "UNDEFVAR"
+   DUMP-NEXT:not:1'2                        uses undefined variable(s): "UNDEFVAR"
 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
@@ -1362,6 +1362,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.331411.patch
Type: text/x-patch
Size: 3901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210317/671956f7/attachment.bin>


More information about the llvm-commits mailing list