preamble.c revision f033f1da4a34f8df6e95e9929dc04ff54bb8fb01
1f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor// Preamble detection test: see below for comments and test commands.
2f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor
3f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#include <blah>
4f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#ifndef FOO
5f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#else
6f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#ifdef BAR
7f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#elif WIBBLE
8f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#endif
9f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#pragma unknown
10f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#endif
11f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor
12f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#ifdef WIBBLE
13f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#include "honk"
14f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#else
15f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregorint foo();
16f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor#endif
17f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor
18f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor// This test checks for detection of the preamble of a file, which
19f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor// includes all of the starting comments and #includes. Note that any
20f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor// changes to the preamble part of this file must be mirrored in
21f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor// Inputs/preamble.txt, since we diff against it.
22f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor
23f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor// RUN: %clang_cc1 -print-preamble %s > %t
24f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor// RUN: diff %t %S/Inputs/preamble.txt
25f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor
26