Clang Project

clang_source_code/test/PCH/pch-through2.cpp
1// Create
2// RUN: %clang_cc1 -I %S -emit-pch \
3// RUN:   -pch-through-header=Inputs/pch-through2.h -o %t.1 %s
4
5// Use
6// RUN: %clang_cc1 -I %S -include-pch %t.1 \
7// RUN:   -pch-through-header=Inputs/pch-through2.h %s
8
9// No #include of through header during pch use
10// RUN: not %clang_cc1 -I %S -include-pch %t.1 \
11// RUN:   -pch-through-header=Inputs/pch-through2.h \
12// RUN:   %S/Inputs/pch-through-use1.cpp 2>&1 \
13// RUN:   | FileCheck -check-prefix=CHECK-TEST2A %s
14// CHECK-TEST2A: fatal error:{{.*}} #include of
15// CHECK-TEST2A-SAME: 'Inputs/pch-through2.h' not seen while attempting to
16// CHECK-TEST2A-SAME: use precompiled header
17
18// check that pch only contains code before the through header.
19// RUN: %clang_cc1 -I %S -emit-pch \
20// RUN:   -pch-through-header=Inputs/pch-through1.h -o %t.2 %s
21// RUN: not %clang_cc1 -I %S -include-pch %t.2 \
22// RUN:   -pch-through-header=Inputs/pch-through1.h \
23// RUN:   %S/Inputs/pch-through-use1.cpp 2>&1 \
24// RUN:   | FileCheck -check-prefix=CHECK-TEST3 %s
25// CHECK-TEST3: error: use of undeclared identifier 'through2'
26
27#include "Inputs/pch-through1.h"
28#include "Inputs/pch-through2.h"
29