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

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 15:54:34 PST 2021


jdenny created this revision.
jdenny added reviewers: thopre, jhenderson, probinson.
Herald added a subscriber: hiraditya.
jdenny requested review of this revision.
Herald added a project: LLVM.

Fixed substitution printing not to produce an empty diagnostic for 
errors handled elsewhere.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98088

Files:
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/test/FileCheck/check-not-numeric-error.txt


Index: llvm/test/FileCheck/check-not-numeric-error.txt
===================================================================
--- llvm/test/FileCheck/check-not-numeric-error.txt
+++ llvm/test/FileCheck/check-not-numeric-error.txt
@@ -2,10 +2,6 @@
 ; and --implicit-check-not.  Moreover, it only printed the error diagnostic 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 at the end of the dump.  These will be fixed in a
-; subsequent patch.
 
 RUN: echo 'CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]]' > %t.chk
 RUN: echo '10000000000000000' > %t.in
@@ -26,9 +22,6 @@
     ERR-NEXT:{{ *}}^
     ERR-NEXT:{{.*}}: note: scanning from here
     ERR-NEXT:10000000000000000
-    ERR-NEXT:^
-    ERR-NEXT:{{.*}}: note: 
-    ERR-NEXT:10000000000000000
     ERR-NEXT:^
      ERR-NOT:{{error|note|remark}}:
 
@@ -36,7 +29,6 @@
    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-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
@@ -1333,6 +1333,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.328678.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210305/e1c750f1/attachment.bin>


More information about the llvm-commits mailing list