Skip to content

Commit

Permalink
[Driver] Always write a build record, even if there's only one input.
Browse files Browse the repository at this point in the history
Don't just exec() a subprocess if there's more work to do when the build
finishes.

Swift SVN r28775
  • Loading branch information
jrose-apple committed May 19, 2015
1 parent 4b4f909 commit 31b3099
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Driver/Compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,10 @@ static void writeCompilationRecord(
}

int Compilation::performJobs() {
// We require buffered output if Parseable output was requested.
bool RequiresBufferedOutput = (Level == OutputLevel::Parseable);
if (!RequiresBufferedOutput) {
// If we don't have to do any cleanup work, just exec the subprocess.
if (Level < OutputLevel::Parseable &&
(SaveTemps || TempFilePaths.empty()) &&
CompilationRecordPath.empty()) {
if (const Job *OnlyCmd = getOnlyCommandInList(Jobs.get()))
return performSingleCommand(OnlyCmd);
}
Expand Down
10 changes: 10 additions & 0 deletions test/Driver/Dependencies/independent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// RUN: touch -t 201401240005 %t/*

// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
// RUN: ls %t/main~buildrecord.swiftdeps

// CHECK-FIRST-NOT: warning
// CHECK-FIRST: Handled main.swift
Expand Down Expand Up @@ -35,3 +36,12 @@
// RUN: rm %t/*.o
// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST-MULTI %s


// RUN: rm -rf %t && cp -r %S/Inputs/independent/ %t
// RUN: touch -t 201401240005 %t/*

// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SINGLE %s
// CHECK-SINGLE: Handled main.swift

// RUN: ls %t/main~buildrecord.swiftdeps

0 comments on commit 31b3099

Please sign in to comment.