xref: /minix3/external/bsd/llvm/dist/clang/test/Lexer/preamble.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Preamble detection test: see below for comments and test commands.
2*f4a2713aSLionel Sambuc //* A BCPL comment that includes '/*'
3*f4a2713aSLionel Sambuc #include <blah>
4*f4a2713aSLionel Sambuc #ifndef FOO
5*f4a2713aSLionel Sambuc #else
6*f4a2713aSLionel Sambuc #ifdef BAR
7*f4a2713aSLionel Sambuc #elif WIBBLE
8*f4a2713aSLionel Sambuc #endif
9*f4a2713aSLionel Sambuc #pragma unknown
10*f4a2713aSLionel Sambuc #endif
11*f4a2713aSLionel Sambuc #ifdef WIBBLE
12*f4a2713aSLionel Sambuc #include "honk"
13*f4a2713aSLionel Sambuc #else
14*f4a2713aSLionel Sambuc int foo();
15*f4a2713aSLionel Sambuc #endif
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // This test checks for detection of the preamble of a file, which
18*f4a2713aSLionel Sambuc // includes all of the starting comments and #includes. Note that any
19*f4a2713aSLionel Sambuc // changes to the preamble part of this file must be mirrored in
20*f4a2713aSLionel Sambuc // Inputs/preamble.txt, since we diff against it.
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -print-preamble %s > %t
23*f4a2713aSLionel Sambuc // RUN: echo END. >> %t
24*f4a2713aSLionel Sambuc // RUN: FileCheck < %t %s
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc // CHECK: // Preamble detection test: see below for comments and test commands.
27*f4a2713aSLionel Sambuc // CHECK-NEXT: //* A BCPL comment that includes '/*'
28*f4a2713aSLionel Sambuc // CHECK-NEXT: #include <blah>
29*f4a2713aSLionel Sambuc // CHECK-NEXT: #ifndef FOO
30*f4a2713aSLionel Sambuc // CHECK-NEXT: #else
31*f4a2713aSLionel Sambuc // CHECK-NEXT: #ifdef BAR
32*f4a2713aSLionel Sambuc // CHECK-NEXT: #elif WIBBLE
33*f4a2713aSLionel Sambuc // CHECK-NEXT: #endif
34*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma unknown
35*f4a2713aSLionel Sambuc // CHECK-NEXT: #endif
36*f4a2713aSLionel Sambuc // CHECK-NEXT: END.
37