xref: /aosp_15_r20/external/clang/test/Frontend/verify2.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li #if 0
2*67e74705SXin Li // RUN: not %clang_cc1 -verify %s 2>&1 | FileCheck %s
3*67e74705SXin Li 
4*67e74705SXin Li // Please note that all comments are inside "#if 0" blocks so that
5*67e74705SXin Li // VerifyDiagnosticConsumer sees no comments while processing this
6*67e74705SXin Li // test-case (and hence no expected-* directives).
7*67e74705SXin Li #endif
8*67e74705SXin Li 
9*67e74705SXin Li #include "verify2.h"
10*67e74705SXin Li #error source
11*67e74705SXin Li 
12*67e74705SXin Li #if 0
13*67e74705SXin Li // expected-error {{should be ignored}}
14*67e74705SXin Li 
15*67e74705SXin Li //      CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
16*67e74705SXin Li // CHECK-NEXT: error: 'error' diagnostics seen but not expected:
17*67e74705SXin Li // CHECK-NEXT:   Line 5: header
18*67e74705SXin Li // CHECK-NEXT:   Line 10: source
19*67e74705SXin Li // CHECK-NEXT: 3 errors generated.
20*67e74705SXin Li #endif
21*67e74705SXin Li 
22*67e74705SXin Li #ifdef CHECK2
23*67e74705SXin Li // RUN: not %clang_cc1 -DCHECK2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
24*67e74705SXin Li 
25*67e74705SXin Li // The following checks that -verify can match "any line" in an included file.
26*67e74705SXin Li // The location of the diagnostic need therefore only match in the file, not to
27*67e74705SXin Li // a specific line number.  This is useful where -verify is used as a testing
28*67e74705SXin Li // tool for 3rd-party libraries where headers may change and the specific line
29*67e74705SXin Li // number of a diagnostic in a header is not important.
30*67e74705SXin Li 
31*67e74705SXin Li // [email protected]:* {{header}}
32*67e74705SXin Li // [email protected]:* {{unknown}}
33*67e74705SXin Li 
34*67e74705SXin Li //      CHECK2: error: 'error' diagnostics expected but not seen:
35*67e74705SXin Li // CHECK2-NEXT:   File {{.*}}verify2.h Line * (directive at {{.*}}verify2.c:32): unknown
36*67e74705SXin Li // CHECK2-NEXT: error: 'error' diagnostics seen but not expected:
37*67e74705SXin Li // CHECK2-NEXT:   File {{.*}}verify2.c Line 10: source
38*67e74705SXin Li // CHECK2-NEXT: 2 errors generated.
39*67e74705SXin Li #endif
40