Skip to content

Commit 471d146

Browse files
authored
Merge pull request #5336 from modocache/sr-2855-driver-show-incremental-args
[SR-2855] Show args mismatch in -driver-show-incremental
2 parents 880bd30 + 0e760b5 commit 471d146

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/Driver/Driver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ static bool populateOutOfDateMap(InputInfoMap &map, StringRef argsHashStr,
342342
}
343343

344344
if (!optionsMatch) {
345+
if (ShowIncrementalBuildDecisions) {
346+
llvm::outs() << "Incremental compilation has been disabled, because "
347+
<< "different arguments were passed to the compiler.\n";
348+
}
345349
return true;
346350
}
347351

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Test that when:
2+
//
3+
// 1. Using -incremental -v -driver-show-incremental, and...
4+
// 2. ...the arguments passed to the Swift compiler version differ from the ones
5+
// used in the original compilation...
6+
//
7+
// ...then the driver prints a message indicating that incremental compilation
8+
// is disabled.
9+
10+
11+
// RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
12+
// RUN: %S/Inputs/touch.py 443865900 %t/*
13+
// RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps
14+
15+
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path %S/Inputs/update-dependencies.py -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s
16+
// CHECK-INCREMENTAL-NOT: Incremental compilation has been disabled
17+
// CHECK-INCREMENTAL: Queuing main.swift (initial)
18+
19+
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path %S/Inputs/update-dependencies.py -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-ARGS-MISMATCH %s
20+
// CHECK-ARGS-MISMATCH: Incremental compilation has been disabled{{.*}}different arguments
21+
// CHECK-ARGS-MISMATCH-NOT: Queuing main.swift (initial)
22+

0 commit comments

Comments
 (0)