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