| 1 |
// If a toolchain uses an external assembler, the test would fail because using |
| 2 |
// an external assember would increase job counts. Most toolchains in tree |
| 3 |
// use integrated assembler, but we still support external assembler. |
| 4 |
// So -fintegrated-as is specified explicitly when applicable. |
| 5 |
|
| 6 |
// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 | FileCheck %s --check-prefix=YES |
| 7 |
// RUN: %clang -fno-integrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=NO |
| 8 |
|
| 9 |
// RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -c -### %s 2>&1 \ |
| 10 |
// RUN: | FileCheck %s --check-prefix=NO |
| 11 |
// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 \ |
| 12 |
// RUN: | FileCheck %s --check-prefix=YES |
| 13 |
|
| 14 |
// RUN: %clang_cl -fintegrated-cc1 -fintegrated-as -c -### -- %s 2>&1 \ |
| 15 |
// RUN: | FileCheck %s --check-prefix=YES |
| 16 |
// RUN: %clang_cl -fno-integrated-cc1 -c -### -- %s 2>&1 \ |
| 17 |
// RUN: | FileCheck %s --check-prefix=NO |
| 18 |
|
| 19 |
// RUN: env CCC_OVERRIDE_OPTIONS=+-fintegrated-cc1 \ |
| 20 |
// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %s 2>&1 \ |
| 21 |
// RUN: | FileCheck %s --check-prefix=YES |
| 22 |
// RUN: env CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1 \ |
| 23 |
// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \ |
| 24 |
// RUN: | FileCheck %s --check-prefix=NO |
| 25 |
|
| 26 |
// YES: (in-process) |
| 27 |
// NO-NOT: (in-process) |
| 28 |
|
| 29 |
// The following tests ensure that only one integrated-cc1 is executed. |
| 30 |
|
| 31 |
// Only one TU, one job, thus integrated-cc1 is enabled. |
| 32 |
// RUN: %clang -fintegrated-cc1 -fintegrated-as -c %s -### 2>&1 | FileCheck %s --check-prefix=YES |
| 33 |
|
| 34 |
// Only one TU, but we're linking, two jobs, thus integrated-cc1 is disabled. |
| 35 |
// RUN: %clang -fintegrated-cc1 %s -### 2>&1 | FileCheck %s --check-prefix=NO |
| 36 |
|
| 37 |
// RUN: echo 'int main() { return f() + g(); }' > %t1.cpp |
| 38 |
// RUN: echo 'int f() { return 1; }' > %t2.cpp |
| 39 |
// RUN: echo 'int g() { return 2; }' > %t3.cpp |
| 40 |
|
| 41 |
// Three jobs, thus integrated-cc1 is disabled. |
| 42 |
// RUN: %clang -fintegrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=NO |
| 43 |
|
| 44 |
// -fintegrated-cc1 works with cc1as. |
| 45 |
// macOS triples have an extra -x assembler-with-cpp job so (in-process) is not triggered. |
| 46 |
// RUN: echo > %t.s |
| 47 |
// RUN: %clang --target=x86_64-linux -fintegrated-cc1 -fintegrated-as -c -### %t.s 2>&1 | FileCheck %s --check-prefix=YES |
| 48 |
// RUN: %clang --target=x86_64-linux -fno-integrated-cc1 -c -### %t.s 2>&1 | FileCheck %s --check-prefix=NO |