1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[FileCheck] Fix redundant diagnostics due to numeric errors

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

Reviewed By: thopre

Differential Revision: https://reviews.llvm.org/D98088
This commit is contained in:
Joel E. Denny 2021-03-17 14:17:41 -04:00
parent 20f8c79d86
commit 37c0143419
3 changed files with 4 additions and 18 deletions

View File

@ -1362,6 +1362,8 @@ void Pattern::printSubstitutions(const SourceMgr &SM, StringRef Buffer,
OS << " ";
E.log(OS);
});
if (!OS.tell())
continue;
} else {
// Substitution succeeded. Print substituted value.
OS << "with \"";

View File

@ -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-VV-EMPTY:
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 @@ ERR-VV-EMPTY:
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:>>>>>>

View File

@ -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 @@ RUN: echo > %t.in '10000000000000000'
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 @@ RUN: echo > %t.in '10000000000000000'
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:>>>>>>
;--------------------------------------------------