Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
cfe/trunk/test/Driver/cl-pch.cpp
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | |||||
// /Ycfoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h | // /Ycfoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h | ||||
// => foo1 and foo2 go into pch, foo3 into main compilation | // => foo1 and foo2 go into pch, foo3 into main compilation | ||||
// /Yc | // /Yc | ||||
// RUN: %clang_cl -Werror /Ycfoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h /c -### -- %s 2>&1 \ | // RUN: %clang_cl -Werror /Ycfoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h /c -### -- %s 2>&1 \ | ||||
// RUN: | FileCheck -check-prefix=CHECK-YCFIFIFI %s | // RUN: | FileCheck -check-prefix=CHECK-YCFIFIFI %s | ||||
// 1. Build .pch file: Includes foo1.h (but NOT foo3.h) and compiles foo2.h | // 1. Build .pch file: Includes foo1.h (but NOT foo3.h) and compiles foo2.h | ||||
// CHECK-YCFIFIFI: cc1 | // CHECK-YCFIFIFI: cc1 | ||||
// CHECK-YCFIFIFI: -emit-pch | // CHECK-YCFIFIFI: -emit-pch | ||||
// CHECK-YCFIFIFI: -pch-through-header=foo2.h | |||||
// CHECK-YCFIFIFI: -include | // CHECK-YCFIFIFI: -include | ||||
// CHECK-YCFIFIFI: foo1.h | // CHECK-YCFIFIFI: foo1.h | ||||
// CHECK-YCFIFIFI-NOT: foo2.h | // CHECK-YCFIFIFI: -include | ||||
// CHECK-YCFIFIFI-NOT: foo3.h | // CHECK-YCFIFIFI: foo2.h | ||||
// CHECK-YCFIFIFI: -include | |||||
// CHECK-YCFIFIFI: foo3.h | |||||
// CHECK-YCFIFIFI: -o | // CHECK-YCFIFIFI: -o | ||||
// CHECK-YCFIFIFI: foo2.pch | // CHECK-YCFIFIFI: foo2.pch | ||||
// CHECK-YCFIFIFI: -x | // CHECK-YCFIFIFI: -x | ||||
// CHECK-YCFIFIFI: "c++-header" | // CHECK-YCFIFIFI: "c++-header" | ||||
// CHECK-YCFIFIFI: foo2.h | // CHECK-YCFIFIFI: cl-pch.cpp | ||||
// 2. Use .pch file: Inlucdes foo2.pch and foo3.h | // 2. Use .pch file: Inlucdes foo2.pch and foo3.h | ||||
// CHECK-YCFIFIFI: cc1 | // CHECK-YCFIFIFI: cc1 | ||||
// CHECK-YCFIFIFI: -emit-obj | // CHECK-YCFIFIFI: -emit-obj | ||||
// CHECK-YCFIFIFI-NOT: foo1.h | |||||
// CHECK-YCFIFIFI-NOT: foo2.h | |||||
// CHECK-YCFIFIFI: -include-pch | // CHECK-YCFIFIFI: -include-pch | ||||
// CHECK-YCFIFIFI: foo2.pch | // CHECK-YCFIFIFI: foo2.pch | ||||
// CHECK-YCFIFIFI: -pch-through-header=foo2.h | |||||
// CHECK-YCFIFIFI: -include | |||||
// CHECK-YCFIFIFI: foo1.h | |||||
// CHECK-YCFIFIFI: -include | |||||
// CHECK-YCFIFIFI: foo2.h | |||||
// CHECK-YCFIFIFI: -include | // CHECK-YCFIFIFI: -include | ||||
// CHECK-YCFIFIFI: foo3.h | // CHECK-YCFIFIFI: foo3.h | ||||
// CHECK-YCFIFIFI: -o | |||||
// CHECK-YCFIFIFI: cl-pch.obj | |||||
// CHECK-YCFIFIFI: -x | |||||
// CHECK-YCFIFIFI: "c++" | |||||
// CHECK-YCFIFIFI: cl-pch.cpp | |||||
// /Yucfoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h | // /Yufoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h | ||||
// => foo1 foo2 filtered out, foo3 into main compilation | // => foo1 foo2 filtered out, foo3 into main compilation | ||||
// RUN: %clang_cl -Werror /Yufoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h /c -### -- %s 2>&1 \ | // RUN: %clang_cl -Werror /Yufoo2.h /FIfoo1.h /FIfoo2.h /FIfoo3.h /c -### -- %s 2>&1 \ | ||||
// RUN: | FileCheck -check-prefix=CHECK-YUFIFIFI %s | // RUN: | FileCheck -check-prefix=CHECK-YUFIFIFI %s | ||||
// Use .pch file, but don't build it. | // Use .pch file, but don't build it. | ||||
// CHECK-YUFIFIFI-NOT: -emit-pch | // CHECK-YUFIFIFI-NOT: -emit-pch | ||||
// CHECK-YUFIFIFI: cc1 | // CHECK-YUFIFIFI: cc1 | ||||
// CHECK-YUFIFIFI: -emit-obj | // CHECK-YUFIFIFI: -emit-obj | ||||
// CHECK-YUFIFIFI-NOT: foo1.h | |||||
// CHECK-YUFIFIFI-NOT: foo2.h | |||||
// CHECK-YUFIFIFI: -include-pch | // CHECK-YUFIFIFI: -include-pch | ||||
// CHECK-YUFIFIFI: foo2.pch | // CHECK-YUFIFIFI: foo2.pch | ||||
// CHECK-YUFIFIFI: -pch-through-header=foo2.h | |||||
// CHECK-YUFIFIFI: -include | |||||
// CHECK-YUFIFIFI: foo1.h | |||||
// CHECK-YUFIFIFI: -include | |||||
// CHECK-YUFIFIFI: foo2.h | |||||
// CHECK-YUFIFIFI: -include | // CHECK-YUFIFIFI: -include | ||||
// CHECK-YUFIFIFI: foo3.h | // CHECK-YUFIFIFI: foo3.h | ||||
// FIXME: Implement support for /Ycfoo.h / /Yufoo.h without /FIfoo.h | // Test /Ycfoo.h / /Yufoo.h without /FIfoo.h | ||||
// RUN: %clang_cl -Werror /Ycfoo.h /c -### -- %s 2>&1 \ | // RUN: %clang_cl -Werror /Ycfoo.h /c -### -- %s 2>&1 \ | ||||
// RUN: | FileCheck -check-prefix=CHECK-YC-NOFI %s | // RUN: | FileCheck -check-prefix=CHECK-YC-NOFI %s | ||||
// CHECK-YC-NOFI: error: support for '/Yc' without a corresponding /FI flag not implemented yet; flag ignored | // 1. Precompile | ||||
// CHECK-YC-NOFI: cc1 | |||||
// CHECK-YC-NOFI: -emit-pch | |||||
// CHECK-YC-NOFI: -pch-through-header=foo.h | |||||
// CHECK-YC-NOFI: -o | |||||
// CHECK-YC-NOFI: foo.pch | |||||
// CHECK-YC-NOFI: -x | |||||
// CHECK-YC-NOFI: c++-header | |||||
// CHECK-YC-NOFI: cl-pch.cpp | |||||
// 2. Build PCH object | |||||
// CHECK-YC-NOFI: cc1 | |||||
// CHECK-YC-NOFI: -emit-obj | |||||
// CHECK-YC-NOFI: -include-pch | |||||
// CHECK-YC-NOFI: foo.pch | |||||
// CHECK-YC-NOFI: -pch-through-header=foo.h | |||||
// CHECK-YC-NOFI: -x | |||||
// CHECK-YC-NOFI: c++ | |||||
// CHECK-YC-NOFI: cl-pch.cpp | |||||
// RUN: %clang_cl -Werror /Yufoo.h /c -### -- %s 2>&1 \ | // RUN: %clang_cl -Werror /Yufoo.h /c -### -- %s 2>&1 \ | ||||
// RUN: | FileCheck -check-prefix=CHECK-YU-NOFI %s | // RUN: | FileCheck -check-prefix=CHECK-YU-NOFI %s | ||||
// CHECK-YU-NOFI: error: support for '/Yu' without a corresponding /FI flag not implemented yet; flag ignored | // CHECK-YU-NOFI: cc1 | ||||
// CHECK-YU-NOFI: -emit-obj | |||||
// /Yc and /FI relative to /I paths... | // CHECK-YU-NOFI: -include-pch | ||||
// The rules are: | // CHECK-YU-NOFI: foo.pch | ||||
// Yu/Yc and FI parameter must match exactly, else it's not found | // CHECK-YU-NOFI: -pch-through-header=foo.h | ||||
// Must match literally exactly: /FI./foo.h /Ycfoo.h does _not_ work. | // CHECK-YU-NOFI: -x | ||||
// However, the path can be relative to /I paths. | // CHECK-YU-NOFI: c++ | ||||
// FIXME: Update the error messages below once /FI is no longer required, but | // CHECK-YU-NOFI: cl-pch.cpp | ||||
// these test cases all should stay failures as they fail with cl.exe. | |||||
// Check that ./ isn't canonicalized away. | |||||
// RUN: %clang_cl -Werror /Ycpchfile.h /FI./pchfile.h /c -### -- %s 2>&1 \ | |||||
// RUN: | FileCheck -check-prefix=CHECK-YC-I1 %s | |||||
// CHECK-YC-I1: support for '/Yc' without a corresponding /FI flag not implemented yet; flag ignored | |||||
// Check that ./ isn't canonicalized away. | |||||
// RUN: %clang_cl -Werror /Yc./pchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ | |||||
// RUN: | FileCheck -check-prefix=CHECK-YC-I2 %s | |||||
// CHECK-YC-I2: support for '/Yc' without a corresponding /FI flag not implemented yet; flag ignored | |||||
// With an actual /I argument. | // With an actual /I argument. | ||||
// RUN: %clang_cl -Werror /Ifoo /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ | // RUN: %clang_cl -Werror /Ifoo /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ | ||||
// RUN: | FileCheck -check-prefix=CHECK-YC-I3 %s | // RUN: | FileCheck -check-prefix=CHECK-YC-I3 %s | ||||
// 1. This writes pchfile.pch into the root dir, even if this will pick up | // 1. This writes pchfile.pch into the root dir, even if this will pick up | ||||
// foo/pchfile.h | // foo/pchfile.h | ||||
// CHECK-YC-I3: cc1 | // CHECK-YC-I3: cc1 | ||||
// CHECK-YC-I3: -emit-pch | // CHECK-YC-I3: -emit-pch | ||||
// CHECK-YC-I3: -o | // CHECK-YC-I3: -o | ||||
// CHECK-YC-I3: pchfile.pch | // CHECK-YC-I3: pchfile.pch | ||||
// 2. Use .pch file. | // 2. Use .pch file. | ||||
// CHECK-YC-I3: cc1 | // CHECK-YC-I3: cc1 | ||||
// CHECK-YC-I3: -emit-obj | // CHECK-YC-I3: -emit-obj | ||||
// CHECK-YC-I3: -include-pch | // CHECK-YC-I3: -include-pch | ||||
// CHECK-YC-I3: pchfile.pch | // CHECK-YC-I3: pchfile.pch | ||||
// Check that ./ isn't canonicalized away for /Yu either. | |||||
// RUN: %clang_cl -Werror /Yupchfile.h /FI./pchfile.h /c -### -- %s 2>&1 \ | |||||
// RUN: | FileCheck -check-prefix=CHECK-YU-I1 %s | |||||
// CHECK-YU-I1: support for '/Yu' without a corresponding /FI flag not implemented yet; flag ignored | |||||
// But /FIfoo/bar.h /Ycfoo\bar.h does work, as does /FIfOo.h /Ycfoo.H | // But /FIfoo/bar.h /Ycfoo\bar.h does work, as does /FIfOo.h /Ycfoo.H | ||||
// FIXME: This part isn't implemented yet. The following two tests should not | |||||
// show an error but do regular /Yu handling. | |||||
// RUN: %clang_cl -Werror /YupchFILE.h /FI./pchfile.h /c -### -- %s 2>&1 \ | // RUN: %clang_cl -Werror /YupchFILE.h /FI./pchfile.h /c -### -- %s 2>&1 \ | ||||
// RUN: | FileCheck -check-prefix=CHECK-YU-CASE %s | // RUN: | FileCheck -check-prefix=CHECK-YU-CASE %s | ||||
// CHECK-YU-CASE: support for '/Yu' without a corresponding /FI flag not implemented yet; flag ignored | // CHECK-YU-CASE: -pch-through-header=pchFILE.h | ||||
// RUN: %clang_cl -Werror /Yu./pchfile.h /FI.\pchfile.h /c -### -- %s 2>&1 \ | // CHECK-YU-CASE: -include | ||||
// CHECK-YU-CASE: "./pchfile.h" | |||||
// RUN: %clang_cl -Werror /Yu./pchfile.h /FI.\\pchfile.h /c -### -- %s 2>&1 \ | |||||
// RUN: | FileCheck -check-prefix=CHECK-YU-SLASH %s | // RUN: | FileCheck -check-prefix=CHECK-YU-SLASH %s | ||||
// CHECK-YU-SLASH: support for '/Yu' without a corresponding /FI flag not implemented yet; flag ignored | // CHECK-YU-SLASH: -pch-through-header=./pchfile.h | ||||
// CHECK-YU-SLASH: -include | |||||
// CHECK-YU-SLASH: ".{{[/\\]+}}pchfile.h" | |||||
// cl.exe warns on multiple /Yc, /Yu, /Fp arguments, but clang-cl silently just | // cl.exe warns on multiple /Yc, /Yu, /Fp arguments, but clang-cl silently just | ||||
// uses the last one. This is true for e.g. /Fo too, so not warning on this | // uses the last one. This is true for e.g. /Fo too, so not warning on this | ||||
// is self-consistent with clang-cl's flag handling. | // is self-consistent with clang-cl's flag handling. | ||||
// Interaction with /fallback | // Interaction with /fallback | ||||
// /Yc /fallback => /Yc not passed on (but /FI is) | // /Yc /fallback => /Yc not passed on (but /FI is) | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |