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 \""; 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::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/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::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:>>>>>> ;--------------------------------------------------