47 lines · c
1// REQUIRES: system-windows2//3// RUN: rm -rf %t4// RUN: mkdir %t5//6// Note: %s and %S must be preceded by --, otherwise it may be interpreted as a7// command-line option, e.g. on Mac where %s is commonly under /Users.8 9// The main test for clang-cl pch handling is cl-pch.cpp. This file only checks10// a few things for .c inputs.11 12// /Yc with a .c file should build a c pch file.13// RUN: %clang_cl -Werror /Yc%S/Inputs/pchfile.h /FI%S/Inputs/pchfile.h /c /Fo%t/pchfile.obj /Fp%t/pchfile.pch -v -- %s 2>&1 \14// RUN: | FileCheck -check-prefix=CHECK-YC %s15// CHECK-YC: cc1{{.* .*}}-emit-pch16// CHECK-YC-SAME: -o17// CHECK-YC-SAME: pchfile.pch18// CHECK-YC-SAME: -x19// CHECK-YC-SAME: c-header20 21// But not if /TP changes the input language to C++.22// RUN: %clang_cl /TP -Werror /Yc%S/Inputs/pchfile.h /FI%S/Inputs/pchfile.h /c /Fo%t/pchfile.obj /Fp%t/pchfile.pch -v -- %s 2>&1 \23// RUN: | FileCheck -check-prefix=CHECK-YCTP %s24// CHECK-YCTP: cc1{{.* .*}}-emit-pch25// CHECK-YCTP-SAME: -o26// CHECK-YCTP-SAME: pchfile.pch27// CHECK-YCTP-SAME: -x28// CHECK-YCTP-SAME: c++-header29 30// Except if a later /TC changes it back.31// RUN: %clang_cl -Werror /Yc%S/Inputs/pchfile.h /FI%S/Inputs/pchfile.h /c /Fo%t/pchfile.obj /Fp%t/pchfile.pch -v -- %s 2>&1 \32// RUN: | FileCheck -check-prefix=CHECK-YCTPTC %s33// CHECK-YCTPTC: cc1{{.* .*}}-emit-pch34// CHECK-YCTPTC-SAME: -o35// CHECK-YCTPTC-SAME: pchfile.pch36// CHECK-YCTPTC-SAME: -x37// CHECK-YCTPTC-SAME: c-header38 39// Also check lower-case /Tp flag.40// RUN: %clang_cl -Werror /Tp%s /Yc%S/Inputs/pchfile.h /FI%S/Inputs/pchfile.h /c /Fo%t/pchfile.obj /Fp%t/pchfile.pch -v 2>&1 \41// RUN: | FileCheck -check-prefix=CHECK-YCTp %s42// CHECK-YCTp: cc1{{.* .*}}-emit-pch43// CHECK-YCTp-SAME: -o44// CHECK-YCTp-SAME: pchfile.pch45// CHECK-YCTp-SAME: -x46// CHECK-YCTp-SAME: c++-header47