brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · debaeb6 Raw
40 lines · c
1#if 02// RUN: not %clang_cc1 -verify %s 2>&1 | FileCheck %s3 4// Please note that all comments are inside "#if 0" blocks so that5// VerifyDiagnosticConsumer sees no comments while processing this6// test-case (and hence no expected-* directives).7#endif8 9#include "verify2.h"10#error source11 12#if 013// expected-error {{should be ignored}}14 15//      CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'16// CHECK-NEXT: error: 'expected-error' diagnostics seen but not expected:17// CHECK-NEXT:   Line 5: header18// CHECK-NEXT:   Line 10: source19// CHECK-NEXT: 3 errors generated.20#endif21 22#ifdef CHECK223// RUN: not %clang_cc1 -DCHECK2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s24 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 to27// a specific line number.  This is useful where -verify is used as a testing28// tool for 3rd-party libraries where headers may change and the specific line29// 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: 'expected-error' diagnostics expected but not seen:35// CHECK2-NEXT:   File {{.*}}verify2.h Line * (directive at {{.*}}verify2.c:32): unknown36// CHECK2-NEXT: error: 'expected-error' diagnostics seen but not expected:37// CHECK2-NEXT:   File {{.*}}verify2.c Line 10: source38// CHECK2-NEXT: 2 errors generated.39#endif40