blob: 075a2ab6e0f01ca3181ae40f11787b92f59c4acc [file] [log] [blame]
Jordan Roseb00073d2012-08-10 01:06:16 +00001#if 0
Rafael Espindola925213b2013-07-04 16:16:58 +00002// RUN: not %clang_cc1 -verify %s 2>&1 | FileCheck %s
Jordan Roseb00073d2012-08-10 01:06:16 +00003
4// Please note that all comments are inside "#if 0" blocks so that
5// VerifyDiagnosticConsumer sees no comments while processing this
Andy Gibbs0fea0452012-10-19 12:49:32 +00006// test-case (and hence no expected-* directives).
Jordan Roseb00073d2012-08-10 01:06:16 +00007#endif
8
9#include "verify2.h"
10#error source
11
12#if 0
13// expected-error {{should be ignored}}
14
Andy Gibbs0fea0452012-10-19 12:49:32 +000015// CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
16// CHECK-NEXT: error: 'error' diagnostics seen but not expected:
Andy Gibbsc1f152e2014-07-10 16:43:29 +000017// CHECK-NEXT: Line 5: header
Jordan Roseb00073d2012-08-10 01:06:16 +000018// CHECK-NEXT: Line 10: source
Andy Gibbs0fea0452012-10-19 12:49:32 +000019// CHECK-NEXT: 3 errors generated.
Jordan Roseb00073d2012-08-10 01:06:16 +000020#endif
Andy Gibbsc1f152e2014-07-10 16:43:29 +000021
22#ifdef CHECK2
23// RUN: not %clang_cc1 -DCHECK2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
24
25// The following checks that -verify can match "any line" in an included file.
26// The location of the diagnostic need therefore only match in the file, not to
27// a specific line number. This is useful where -verify is used as a testing
28// tool for 3rd-party libraries where headers may change and the specific line
29// number of a diagnostic in a header is not important.
30
31// expected-error@verify2.h:* {{header}}
32// expected-error@verify2.h:* {{unknown}}
33
34// CHECK2: error: 'error' diagnostics expected but not seen:
35// CHECK2-NEXT: File {{.*}}verify2.h Line * (directive at {{.*}}verify2.c:32): unknown
36// CHECK2-NEXT: error: 'error' diagnostics seen but not expected:
37// CHECK2-NEXT: File {{.*}}verify2.c Line 10: source
38// CHECK2-NEXT: 2 errors generated.
39#endif