Skip to content

Commit 0c4d4d9

Browse files
Merge pull request #67376 from cachemeifyoucan/eng/PR-caching-options-rename
Tweak caching remarks and options
2 parents 3748b0f + 6cf7163 commit 0c4d4d9

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

include/swift/Option/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ def cache_compile_job: Flag<["-"], "cache-compile-job">,
18161816
Flags<[FrontendOption, NewDriverOnlyOption]>,
18171817
HelpText<"Enable compiler caching">;
18181818

1819-
def cache_remarks: Flag<["-"], "cache-remarks">,
1819+
def cache_remarks: Flag<["-"], "Rcache-compile-job">,
18201820
Flags<[FrontendOption, NewDriverOnlyOption]>,
18211821
HelpText<"Show remarks for compiler caching">;
18221822

lib/Frontend/CachingUtils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ bool replayCachedCompilerOutputs(
244244
Diag.diagnose(SourceLoc(), diag::error_replay_cached_diag,
245245
toString(std::move(E)));
246246
return false;
247+
} else {
248+
if (CacheRemarks)
249+
Diag.diagnose(SourceLoc(), diag::replay_output, "<cached-diagnostics>",
250+
DiagnosticsOutput->Key);
247251
}
248252

249253
// Replay the result only when everything is resolved.

test/CAS/cache_replay.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22

33
/// Run the command first time, expect cache miss.
44
/// FIXME: This command doesn't use `-cas-fs` so it is not a good cache entry. It is currently allowed so it is easier to write tests.
5-
// RUN: %target-swift-frontend -cache-compile-job -cache-remarks %s -emit-module -emit-module-path %t/Test.swiftmodule -c -emit-dependencies \
5+
// RUN: %target-swift-frontend -cache-compile-job -Rcache-compile-job %s -emit-module -emit-module-path %t/Test.swiftmodule -c -emit-dependencies \
66
// RUN: -module-name Test -o %t/test.o -cas-path %t/cas -allow-unstable-cache-key-for-testing 2>&1 | %FileCheck --check-prefix=CACHE-MISS %s
77

88
/// Expect cache hit for second time.
9-
// RUN: %target-swift-frontend -cache-compile-job -cache-remarks %s -emit-module -emit-module-path %t/Test.swiftmodule -c -emit-dependencies \
9+
// RUN: %target-swift-frontend -cache-compile-job -Rcache-compile-job %s -emit-module -emit-module-path %t/Test.swiftmodule -c -emit-dependencies \
1010
// RUN: -module-name Test -o %t/test.o -cas-path %t/cas -allow-unstable-cache-key-for-testing 2>&1 | %FileCheck --check-prefix=CACHE-HIT %s
1111

1212
/// Expect cache hit a subset of outputs.
13-
// RUN: %target-swift-frontend -cache-compile-job -cache-remarks %s -emit-module -emit-module-path %t/Test.swiftmodule -c \
13+
// RUN: %target-swift-frontend -cache-compile-job -Rcache-compile-job %s -emit-module -emit-module-path %t/Test.swiftmodule -c \
1414
// RUN: -module-name Test -o %t/test.o -cas-path %t/cas -allow-unstable-cache-key-for-testing 2>&1 | %FileCheck --check-prefix=CACHE-HIT %s
1515

1616
/// Skip cache
17-
// RUN: %target-swift-frontend -cache-compile-job -cache-remarks -cache-disable-replay %s -emit-module -emit-module-path %t/Test.swiftmodule -c \
17+
// RUN: %target-swift-frontend -cache-compile-job -Rcache-compile-job -cache-disable-replay %s -emit-module -emit-module-path %t/Test.swiftmodule -c \
1818
// RUN: -module-name Test -o %t/test.o -cas-path %t/cas -allow-unstable-cache-key-for-testing 2>&1 | %FileCheck --allow-empty --check-prefix=SKIP-CACHE %s
1919

2020
// CACHE-MISS: remark: cache miss output file
21-
// CACHE-HIT: remark: replay output file
21+
// CACHE-HIT: remark: replay output file '<cached-diagnostics>': key 'llvmcas://{{.*}}'
22+
// CACHE-HIT: remark: replay output file '{{.*}}{{/|\\}}test.o': key 'llvmcas://{{.*}}'
23+
// CACHE-HIT: remark: replay output file '{{.*}}{{/|\\}}Test.swiftmodule': key 'llvmcas://{{.*}}'
2224
// SKIP-CACHE-NOT: remark:
2325

2426
func testFunc() {}

0 commit comments

Comments
 (0)