Skip to content

Commit bc7df03

Browse files
committed
Make -fintegrated-cc1 work with cc1as
Tested 0.018s faster on my machine.
1 parent c8f4e06 commit bc7df03

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7186,9 +7186,16 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
71867186
CmdArgs.push_back(Input.getFilename());
71877187

71887188
const char *Exec = getToolChain().getDriver().getClangProgramPath();
7189-
C.addCommand(std::make_unique<Command>(JA, *this,
7190-
ResponseFileSupport::AtFileUTF8(),
7191-
Exec, CmdArgs, Inputs, Output));
7189+
if (D.CC1Main && !D.CCGenDiagnostics) {
7190+
// Invoke cc1as directly in this process.
7191+
C.addCommand(std::make_unique<CC1Command>(JA, *this,
7192+
ResponseFileSupport::AtFileUTF8(),
7193+
Exec, CmdArgs, Inputs, Output));
7194+
} else {
7195+
C.addCommand(std::make_unique<Command>(JA, *this,
7196+
ResponseFileSupport::AtFileUTF8(),
7197+
Exec, CmdArgs, Inputs, Output));
7198+
}
71927199
}
71937200

71947201
// Begin OffloadBundler

clang/test/Driver/cc1-spawnprocess.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@
4040

4141
// Three jobs, thus integrated-cc1 is disabled.
4242
// 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+
// RUN: echo > %t.s
46+
// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %t.s 2>&1 | FileCheck %s --check-prefix=YES
47+
// RUN: %clang -fno-integrated-cc1 -c -### %t.s 2>&1 | FileCheck %s --check-prefix=NO

0 commit comments

Comments
 (0)