// RUN: %clang_cc1 -DTEST1 -verify %s
// RUN: not %clang_cc1 -DTEST2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
// RUN: not %clang_cc1 -DTEST3 -verify %s 2>&1 | FileCheck -check-prefix=CHECK3 %s
// RUN: not %clang_cc1 -DTEST4 -verify %s 2>&1 | FileCheck -check-prefix=CHECK4 %s
// RUN: not %clang_cc1 -DTEST5 -verify %s 2>&1 | FileCheck -check-prefix=CHECK5 %s
// expected-warning@ malformed
// expected-error@7 1 {{missing or invalid line number}}
// expected-warning@0 malformed
// expected-error@10 {{missing or invalid line number}}
// expected-warning@-50 malformed
// expected-error@13 {{missing or invalid line number}}
// expected-warning malformed
// expected-error@16 {{cannot find start}}
// expected-error 0+ {{should also be ignored}}
// expected-error {{should be ignored}}
// eexpected-error {{should also be ignored: unrecognised directive}}
// expected-error@-1 1+ {{should not be ignored}}
unexpected a; // expected-error@+0 + {{unknown type}}
unexpected b; // expected-error@33 1-1 {{unknown type}}
// expected-error@+2 {{file not found}} check that multi-line handled correctly: \
// 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-NEXT: Line 41: define_error
// CHECK2-NEXT: Line 43: line_error
// CHECK2-NEXT: error: '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: Line 42: undef_error
// CHECK2-NEXT: error: '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.
// expected-note {{line_68_ignored}}
// expected-note {{line_70_ignored}}
// expected-note {{line_73}}
// expected-note {{line_75_ignored}}
// expected-note {{line_77_ignored}}
// expected-note {{line_78}}
// CHECK3: error: 'note' diagnostics expected but not seen:
// CHECK3-NEXT: Line 67: line_67
// CHECK3-NEXT: Line 71: line_71
// CHECK3-NEXT: Line 72: line_72
// CHECK3-NEXT: Line 73: line_73
// CHECK3-NEXT: Line 74: line_74
// CHECK3-NEXT: Line 78: line_78
// CHECK3-NEXT: 6 errors generated.
// CHECK4: error: 'error' diagnostics expected but not seen:
// CHECK4-NEXT: Line 92: include_error
// CHECK4-NEXT: error: 'error' diagnostics seen but not expected:
// CHECK4-NEXT: Line 92: 'missing_header_file.include' file not found
// CHECK4-NEXT: 2 errors generated.
// expected-error@50 {{source file test}}
// CHECK5: error: '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.
// 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: (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-NEXT: Line 2 (directive at <stdin>:1): 1
// CHECK7-NEXT: error: 'error' diagnostics seen but not expected:
// CHECK7-NEXT: Line 2: 2
// CHECK7-NEXT: 2 errors generated.
// RUN: not %clang_cc1 -DTEST8 -verify %s 2>&1 | FileCheck -check-prefix=CHECK8 %s
// expected-warning@nonexistent-file:1 {{ }}
// expected-error@-1 {{file 'nonexistent-file' could not be located}}
// expected-warning@verify-directive.h: {{ }}
// expected-error@-1 {{missing or invalid line number}}
// expected-warning@verify-directive.h:0 {{ }}
// expected-error@-1 {{missing or invalid line number}}
// expected-warning@verify-directive.h:0*{{ }}
// expected-error@-1 {{missing or invalid line number}}
// expected-warning@verify-directive.h:*0{{ }}
// syntactically ok -- means match in any line for 0 occurrences.
// expected-warning@verify-directive.h:1 {{diagnostic}}
// CHECK8: error: '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.