Skip to content

Commit 99df208

Browse files
committed
[Driver] Clear deferred commands on each task queue iteration.
1 parent a381aa1 commit 99df208

File tree

6 files changed

+58
-3
lines changed

6 files changed

+58
-3
lines changed

lib/Driver/Compilation.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,11 @@ namespace driver {
222222
}
223223

224224
/// When a task finishes, check other Jobs that may be blocked.
225-
void markFinished(const Job *Cmd) {
225+
void markFinished(const Job *Cmd, bool Skipped=false) {
226226
if (Comp.ShowIncrementalBuildDecisions) {
227-
llvm::outs() << "Job finished: " << LogJob(Cmd) << "\n";
227+
llvm::outs() << "Job "
228+
<< (Skipped ? "skipped" : "finished")
229+
<< ": " << LogJob(Cmd) << "\n";
228230
}
229231
FinishedCommands.insert(Cmd);
230232

@@ -590,8 +592,9 @@ namespace driver {
590592
}
591593

592594
ScheduledCommands.insert(Cmd);
593-
markFinished(Cmd);
595+
markFinished(Cmd, /*Skipped=*/true);
594596
}
597+
DeferredCommands.clear();
595598

596599
// ...which may allow us to go on and do later tasks.
597600
} while (Result == 0 && TQ->hasRemainingTasks());
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class Class1 {
2+
public var Var1 : Int?
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class Class2 {
2+
public var Var2c : Class1?
3+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var x = Class1()
2+
var y = Class2()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"": {
3+
"swift-dependencies": "master.swiftdeps"
4+
},
5+
"main.swift": {
6+
"dependencies": "main.d",
7+
"object": "main.o",
8+
"swiftmodule": "main~partial.swiftmodule",
9+
"swift-dependencies": "main.swiftdeps"
10+
},
11+
"file1.swift": {
12+
"dependencies": "file1.d",
13+
"object": "file1.o",
14+
"swiftmodule": "file1~partial.swiftmodule",
15+
"swift-dependencies": "file1.swiftdeps"
16+
},
17+
"file2.swift": {
18+
"dependencies": "file2.d",
19+
"object": "file2.o",
20+
"swiftmodule": "file2~partial.swiftmodule",
21+
"swift-dependencies": "file2.swiftdeps"
22+
}
23+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// XFAIL: linux
2+
// RUN: rm -rf %t && cp -r %S/Inputs/only-skip-once/ %t
3+
// RUN: touch -t 201401240005 %t/*
4+
5+
// RUN: cd %t && %swiftc_driver -driver-show-incremental -output-file-map %t/output-file-map.json -incremental main.swift file1.swift file2.swift -j1 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
6+
7+
// CHECK-INITIAL-NOT: warning
8+
// CHECK-INITIAL: Job finished: {compile: main.o <= main.swift}
9+
// CHECK-INITIAL: Job finished: {compile: file1.o <= file1.swift}
10+
// CHECK-INITIAL: Job finished: {compile: file2.o <= file2.swift}
11+
// CHECK-INITIAL: Job finished: {link: main <= main.o file1.o file2.o}
12+
13+
// RUN: touch -t 201401240006 %t/file2.swift
14+
// RUN: cd %t && %swiftc_driver -driver-show-incremental -output-file-map %t/output-file-map.json -incremental main.swift file1.swift file2.swift -j1 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD %s
15+
16+
// We should skip the main and file1 rebuilds here, but we should only note skipping them _once_
17+
// CHECK-REBUILD: Job finished: {compile: file2.o <= file2.swift}
18+
// CHECK-REBUILD: Job skipped: {compile: main.o <= main.swift}
19+
// CHECK-REBUILD: Job skipped: {compile: file1.o <= file1.swift}
20+
// CHECK-REBUILD: Job finished: {link: main <= main.o file1.o file2.o}
21+
// CHECK-REBUILD-NOT: Job skipped:

0 commit comments

Comments
 (0)