xref: /aosp_15_r20/external/clang/test/Driver/cl-pch.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1 // Note: %s and %S must be preceded by --, otherwise it may be interpreted as a
2 // command-line option, e.g. on Mac where %s is commonly under /Users.
3 
4 // The main test for clang-cl pch handling is cl-pch.cpp.  This file only checks
5 // a few things for .c inputs.
6 
7 // /Yc with a .c file should build a c pch file.
8 // RUN: %clang_cl -Werror /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \
9 // RUN:   | FileCheck -check-prefix=CHECK-YC %s
10 // CHECK-YC: cc1
11 // CHECK-YC: -emit-pch
12 // CHECK-YC: -o
13 // CHECK-YC: pchfile.pch
14 // CHECK-YC: -x
15 // CHECK-YC: "c"
16 
17 // But not if /TP changes the input language to C++.
18 // RUN: %clang_cl /TP -Werror /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \
19 // RUN:   | FileCheck -check-prefix=CHECK-YCTP %s
20 // CHECK-YCTP: cc1
21 // CHECK-YCTP: -emit-pch
22 // CHECK-YCTP: -o
23 // CHECK-YCTP: pchfile.pch
24 // CHECK-YCTP: -x
25 // CHECK-YCTP: "c++"
26 
27 // Except if a later /TC changes it back.
28 // RUN: %clang_cl -Werror /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \
29 // RUN:   | FileCheck -check-prefix=CHECK-YCTPTC %s
30 // CHECK-YCTPTC: cc1
31 // CHECK-YCTPTC: -emit-pch
32 // CHECK-YCTPTC: -o
33 // CHECK-YCTPTC: pchfile.pch
34 // CHECK-YCTPTC: -x
35 // CHECK-YCTPTC: "c"
36 
37 // Also check lower-case /Tp flag.
38 // RUN: %clang_cl -Werror /Tp%s /Ycpchfile.h /FIpchfile.h /c -### 2>&1 \
39 // RUN:   | FileCheck -check-prefix=CHECK-YCTp %s
40 // CHECK-YCTp: cc1
41 // CHECK-YCTp: -emit-pch
42 // CHECK-YCTp: -o
43 // CHECK-YCTp: pchfile.pch
44 // CHECK-YCTp: -x
45 // CHECK-YCTp: "c++"
46