diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp --- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -876,8 +876,10 @@ OS << ": " << I->second; } + std::string Prefix = *Diags.getDiagnosticOptions().VerifyPrefixes.begin(); + std::string KindStr = Prefix + "-" + Kind; Diags.Report(diag::err_verify_inconsistent_diags).setForceEmit() - << Kind << /*Unexpected=*/true << OS.str(); + << KindStr << /*Unexpected=*/true << OS.str(); return std::distance(diag_begin, diag_end); } @@ -907,8 +909,10 @@ OS << ": " << D->Text; } + std::string Prefix = *Diags.getDiagnosticOptions().VerifyPrefixes.begin(); + std::string KindStr = Prefix + "-" + Kind; Diags.Report(diag::err_verify_inconsistent_diags).setForceEmit() - << Kind << /*Unexpected=*/false << OS.str(); + << KindStr << /*Unexpected=*/false << OS.str(); return DL.size(); } diff --git a/clang/test/ARCMT/verify.m b/clang/test/ARCMT/verify.m --- a/clang/test/ARCMT/verify.m +++ b/clang/test/ARCMT/verify.m @@ -12,6 +12,6 @@ // expected-error@-1 {{}} // CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics' -// CHECK-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK-NEXT: (frontend): error reading '{{.*}}verify.m.tmp.invalid' // CHECK-NEXT: 2 errors generated. diff --git a/clang/test/Frontend/verify-any-file.c b/clang/test/Frontend/verify-any-file.c --- a/clang/test/Frontend/verify-any-file.c +++ b/clang/test/Frontend/verify-any-file.c @@ -7,8 +7,8 @@ // expected-error@*:123 {{invalid line : "*" required}} // -// CHECK: error: 'error' diagnostics expected but not seen: +// CHECK: error: 'expected-error' diagnostics expected but not seen: // CHECK-NEXT: File * Line * (directive at {{.*}}verify-any-file.c:6): missing error -// CHECK-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK-NEXT: File {{.*}}verify-any-file.c Line 8: missing or invalid line number following '@' in expected '*' // CHECK-NEXT: 2 errors generated. diff --git a/clang/test/Frontend/verify-fatal.c b/clang/test/Frontend/verify-fatal.c --- a/clang/test/Frontend/verify-fatal.c +++ b/clang/test/Frontend/verify-fatal.c @@ -7,6 +7,6 @@ // expected-error@-1 {{second fatal}} -// CHECK: error: 'error' diagnostics expected but not seen: +// CHECK: error: 'expected-error' diagnostics expected but not seen: // CHECK-NEXT: Line 6 (directive at {{.*}}verify-fatal.c:7): second fatal // CHECK-NEXT: 1 error generated. diff --git a/clang/test/Frontend/verify-ignore-unexpected.c b/clang/test/Frontend/verify-ignore-unexpected.c --- a/clang/test/Frontend/verify-ignore-unexpected.c +++ b/clang/test/Frontend/verify-ignore-unexpected.c @@ -3,7 +3,7 @@ #ifdef TEST_SWITCH // expected-no-diagnostics #endif -// CHECK-BAD-SWITCH: error: 'error' diagnostics seen but not expected: +// CHECK-BAD-SWITCH: error: 'expected-error' diagnostics seen but not expected: // CHECK-BAD-SWITCH-NEXT: (frontend): invalid value 'aoeu' in '-verify-ignore-unexpected=' // RUN: %clang_cc1 -DTEST1 -verify %s @@ -31,32 +31,32 @@ float x; #endif // CHECK-UNEXP: no expected directives found -// CHECK-UNEXP-NEXT: 'error' diagnostics seen but not expected +// CHECK-UNEXP-NEXT: 'expected-error' diagnostics seen but not expected // CHECK-UNEXP-NEXT: Line {{[0-9]+}}: redefinition of 'x' -// CHECK-UNEXP-NEXT: 'warning' diagnostics seen but not expected +// CHECK-UNEXP-NEXT: 'expected-warning' diagnostics seen but not expected // CHECK-UNEXP-NEXT: Line {{[0-9]+}}: MyWarning2 -// CHECK-UNEXP-NEXT: 'note' diagnostics seen but not expected +// CHECK-UNEXP-NEXT: 'expected-note' diagnostics seen but not expected // CHECK-UNEXP-NEXT: Line {{[0-9]+}}: previous definition is here // CHECK-UNEXP-NEXT: 4 errors generated. // CHECK-NOTE: no expected directives found -// CHECK-NOTE-NEXT: 'error' diagnostics seen but not expected +// CHECK-NOTE-NEXT: 'expected-error' diagnostics seen but not expected // CHECK-NOTE-NEXT: Line {{[0-9]+}}: redefinition of 'x' -// CHECK-NOTE-NEXT: 'warning' diagnostics seen but not expected +// CHECK-NOTE-NEXT: 'expected-warning' diagnostics seen but not expected // CHECK-NOTE-NEXT: Line {{[0-9]+}}: MyWarning2 // CHECK-NOTE-NEXT: 3 errors generated. // CHECK-WARN: no expected directives found -// CHECK-WARN-NEXT: 'error' diagnostics seen but not expected +// CHECK-WARN-NEXT: 'expected-error' diagnostics seen but not expected // CHECK-WARN-NEXT: Line {{[0-9]+}}: redefinition of 'x' -// CHECK-WARN-NEXT: 'note' diagnostics seen but not expected +// CHECK-WARN-NEXT: 'expected-note' diagnostics seen but not expected // CHECK-WARN-NEXT: Line {{[0-9]+}}: previous definition is here // CHECK-WARN-NEXT: 3 errors generated. // CHECK-ERR: no expected directives found -// CHECK-ERR-NEXT: 'warning' diagnostics seen but not expected +// CHECK-ERR-NEXT: 'expected-warning' diagnostics seen but not expected // CHECK-ERR-NEXT: Line {{[0-9]+}}: MyWarning2 -// CHECK-ERR-NEXT: 'note' diagnostics seen but not expected +// CHECK-ERR-NEXT: 'expected-note' diagnostics seen but not expected // CHECK-ERR-NEXT: Line {{[0-9]+}}: previous definition is here // CHECK-ERR-NEXT: 3 errors generated. @@ -65,7 +65,7 @@ #ifdef TEST3 // expected-error {{test3}} #endif -// CHECK-EXP: 'error' diagnostics expected but not seen +// CHECK-EXP: 'expected-error' diagnostics expected but not seen // CHECK-EXP-NEXT: Line {{[0-9]+}}: test3 // RUN: not %clang_cc1 -DTEST4 -verify -verify-ignore-unexpected %s 2>&1 \ diff --git a/clang/test/Frontend/verify-unknown-arg.c b/clang/test/Frontend/verify-unknown-arg.c --- a/clang/test/Frontend/verify-unknown-arg.c +++ b/clang/test/Frontend/verify-unknown-arg.c @@ -2,5 +2,5 @@ // expected-no-diagnostics -// CHECK: error: 'error' diagnostics seen but not expected: +// CHECK: error: 'expected-error' diagnostics seen but not expected: // CHECK-NEXT: (frontend): unknown argument: '-asdf' diff --git a/clang/test/Frontend/verify.c b/clang/test/Frontend/verify.c --- a/clang/test/Frontend/verify.c +++ b/clang/test/Frontend/verify.c @@ -48,15 +48,15 @@ // This is encapsulated in "#if 0" so that the expected-* checks below // are not inadvertently included in the diagnostic checking! -// CHECK2: error: 'error' diagnostics expected but not seen: +// CHECK2: error: 'expected-error' diagnostics expected but not seen: // CHECK2-NEXT: Line 41: define_error // CHECK2-NEXT: Line 43: line_error -// CHECK2-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK2-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK2-NEXT: Line 43: #line directive requires a positive integer argument // CHECK2-NEXT: Line 44: AAA // expected-error {{[{][{]BBB[}][}]}} <- this shall be part of diagnostic -// CHECK2-NEXT: error: 'warning' diagnostics expected but not seen: +// CHECK2-NEXT: error: 'expected-warning' diagnostics expected but not seen: // CHECK2-NEXT: Line 42: undef_error -// CHECK2-NEXT: error: 'warning' diagnostics seen but not expected: +// CHECK2-NEXT: error: 'expected-warning' diagnostics seen but not expected: // CHECK2-NEXT: Line 42: extra tokens at end of #undef directive // CHECK2-NEXT: Line 45: CCC // expected-warning {{[{][{]DDD[}][}]}} <- this shall be part of diagnostic // CHECK2-NEXT: 7 errors generated. @@ -78,7 +78,7 @@ # endif // expected-note {{line_78}} #endif -// CHECK3: error: 'note' diagnostics expected but not seen: +// CHECK3: error: 'expected-note' diagnostics expected but not seen: // CHECK3-NEXT: Line 67: line_67 // CHECK3-NEXT: Line 71: line_71 // CHECK3-NEXT: Line 72: line_72 @@ -91,9 +91,9 @@ #ifdef TEST4 #include "missing_header_file.include" // expected-error {{include_error}} -// CHECK4: error: 'error' diagnostics expected but not seen: +// CHECK4: error: 'expected-error' diagnostics expected but not seen: // CHECK4-NEXT: Line 92: include_error -// CHECK4-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK4-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK4-NEXT: Line 92: 'missing_header_file.include' file not found // CHECK4-NEXT: 2 errors generated. #endif @@ -102,7 +102,7 @@ #include "verify-directive.h" // expected-error@50 {{source file test}} -// CHECK5: error: 'error' diagnostics expected but not seen: +// CHECK5: error: 'expected-error' diagnostics expected but not seen: // CHECK5-NEXT: Line 1 (directive at {{.*}}verify-directive.h:2): include file test // CHECK5-NEXT: Line 50 (directive at {{.*}}verify.c:103): source file test // CHECK5-NEXT: 2 errors generated. @@ -112,15 +112,15 @@ // RUN: not %clang_cc1 -verify %t.invalid 2>&1 | FileCheck -check-prefix=CHECK6 %s // CHECK6: error: no expected directives found: consider use of 'expected-no-diagnostics' -// CHECK6-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK6-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK6-NEXT: (frontend): error reading '{{.*}}verify.c.tmp.invalid' // CHECK6-NEXT: 2 errors generated. // RUN: printf '//expected-error@2{{1}}\n#error 2\n' | not %clang_cc1 -verify 2>&1 | FileCheck -check-prefix=CHECK7 %s -// CHECK7: error: 'error' diagnostics expected but not seen: +// CHECK7: error: 'expected-error' diagnostics expected but not seen: // CHECK7-NEXT: Line 2 (directive at :1): 1 -// CHECK7-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK7-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK7-NEXT: Line 2: 2 // CHECK7-NEXT: 2 errors generated. #endif @@ -145,7 +145,15 @@ // expected-warning@verify-directive.h:1 {{diagnostic}} -// CHECK8: error: 'warning' diagnostics expected but not seen: +// CHECK8: error: 'expected-warning' diagnostics expected but not seen: // CHECK8-NEXT: File {{.*}}verify-directive.h Line 1 (directive at {{.*}}verify.c:146): diagnostic // CHECK8-NEXT: 1 error generated. #endif + + +#ifdef TEST9 +// RUN: not %clang_cc1 -DTEST9 -verify=what %s 2>&1 | FileCheck -check-prefix=CHECK9 %s + +// what-error {{huh?}} +// CHECK9: error: 'what-error' diagnostics expected but not seen: +#endif diff --git a/clang/test/Frontend/verify2.c b/clang/test/Frontend/verify2.c --- a/clang/test/Frontend/verify2.c +++ b/clang/test/Frontend/verify2.c @@ -13,7 +13,7 @@ // expected-error {{should be ignored}} // CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics' -// CHECK-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK-NEXT: Line 5: header // CHECK-NEXT: Line 10: source // CHECK-NEXT: 3 errors generated. @@ -31,9 +31,9 @@ // expected-error@verify2.h:* {{header}} // expected-error@verify2.h:* {{unknown}} -// CHECK2: error: 'error' diagnostics expected but not seen: +// CHECK2: error: 'expected-error' diagnostics expected but not seen: // CHECK2-NEXT: File {{.*}}verify2.h Line * (directive at {{.*}}verify2.c:32): unknown -// CHECK2-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK2-NEXT: error: 'expected-error' diagnostics seen but not expected: // CHECK2-NEXT: File {{.*}}verify2.c Line 10: source // CHECK2-NEXT: 2 errors generated. #endif diff --git a/clang/test/Frontend/verify3.c b/clang/test/Frontend/verify3.c --- a/clang/test/Frontend/verify3.c +++ b/clang/test/Frontend/verify3.c @@ -7,7 +7,7 @@ // expected-no-diagnostics // expected-note {{}} -// CHECK1: error: 'error' diagnostics seen but not expected: +// CHECK1: error: 'expected-error' diagnostics seen but not expected: // CHECK1-NEXT: Line 8: expected directive cannot follow 'expected-no-diagnostics' directive // CHECK1-NEXT: 1 error generated. #endif @@ -18,7 +18,7 @@ // expected-warning@-1 {{X}} // expected-no-diagnostics -// CHECK2: error: 'error' diagnostics seen but not expected: +// CHECK2: error: 'expected-error' diagnostics seen but not expected: // CHECK2-NEXT: Line 19: 'expected-no-diagnostics' directive cannot follow other expected directives // CHECK2-NEXT: 1 error generated. #endif diff --git a/clang/test/Misc/diag-verify.cpp b/clang/test/Misc/diag-verify.cpp --- a/clang/test/Misc/diag-verify.cpp +++ b/clang/test/Misc/diag-verify.cpp @@ -25,7 +25,7 @@ x = y; // expected-error{{use of undeclared identifier 'y' identifier 'y'}} } -//CHECK: error: 'error' diagnostics expected but not seen: +//CHECK: error: 'expected-error' diagnostics expected but not seen: //CHECK: Line 17: use of undeclared identifier 'y' is fine //CHECK: Line 18: abuse of undeclared identifier 'y' //CHECK: Line 19: good use of undeclared identifier 'y' in code @@ -35,7 +35,7 @@ //CHECK: Line 23: use of undeclared identifier 'y'; please declare y before use //CHECK: Line 24: use of use of undeclared identifier 'y' //CHECK: Line 25: use of undeclared identifier 'y' identifier 'y' -//CHECK: error: 'error' diagnostics seen but not expected: +//CHECK: error: 'expected-error' diagnostics seen but not expected: //CHECK: Line 17: use of undeclared identifier 'y' //CHECK: Line 18: use of undeclared identifier 'y' //CHECK: Line 19: use of undeclared identifier 'y'