Skip to content

Commit fba8ec3

Browse files
[CAS] Make CAS plugin options to be cache invariant
Do not add CAS configurations into cache key computation. This ensure if the cache keys are identical if two functionally equivalent plugins are used. This is safe to do because if any of the CAS configurations changes how the cache key is computed, they are going to be directly reflected in the cache key without adding its configuration into the key. rdar://137091843
1 parent 1481557 commit fba8ec3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

include/swift/Option/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,11 +1999,11 @@ def cas_path: Separate<["-"], "cas-path">,
19991999
HelpText<"Path to CAS">, MetaVarName<"<path>">;
20002000

20012001
def cas_plugin_path: Separate<["-"], "cas-plugin-path">,
2002-
Flags<[FrontendOption, NewDriverOnlyOption]>,
2002+
Flags<[FrontendOption, NewDriverOnlyOption, CacheInvariant]>,
20032003
HelpText<"Path to CAS Plugin">, MetaVarName<"<path>">;
20042004

20052005
def cas_plugin_option: Separate<["-"], "cas-plugin-option">,
2006-
Flags<[FrontendOption, NewDriverOnlyOption]>,
2006+
Flags<[FrontendOption, NewDriverOnlyOption, CacheInvariant]>,
20072007
HelpText<"Option pass to CAS Plugin">, MetaVarName<"<name>=<option>">;
20082008

20092009
def clang_scanner_module_cache_path : Separate<["-"], "clang-scanner-module-cache-path">,

test/CAS/cache_key_compute.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
// RUN: diff %t5.casid %t6.casid
5151
// RUN: not diff %t5.casid %t7.casid
5252

53+
/// Check switching CAS plugin path.
54+
// RUN: %cache-tool -cas-path %t/cas -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext -cache-tool-action print-base-key -- \
55+
// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp.cmd -cas-path %t/cas -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext > %t8.casid
56+
// RUN: ln -s %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext %t/libCASPluginTest%llvm_plugin_ext
57+
// RUN: %cache-tool -cas-path %t/cas -cas-plugin-path %t/libCASPluginTest%llvm_plugin_ext -cache-tool-action print-base-key -- \
58+
// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp.cmd -cas-path %t/cas -cas-plugin-path %t/libCASPluginTest%llvm_plugin_ext > %t9.casid
59+
// RUN: diff %t8.casid %t9.casid
60+
5361
/// Test output keys.
5462
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \
5563
// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -emit-module -c -emit-dependencies \

0 commit comments

Comments
 (0)