Skip to content

Commit 94f7c54

Browse files
Merge pull request #83878 from cachemeifyoucan/eng/PR-134363755
[Caching] Do not infer default on disk cas path when parsing options
2 parents 6942742 + 492f5ab commit 94f7c54

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,6 @@ static bool ParseCASArgs(CASOptions &Opts, ArgList &Args,
785785
Opts.CacheSkipReplay |= Args.hasArg(OPT_cache_disable_replay);
786786
if (const Arg *A = Args.getLastArg(OPT_cas_path))
787787
Opts.CASOpts.CASPath = A->getValue();
788-
else if (Opts.CASOpts.CASPath.empty())
789-
Opts.CASOpts.CASPath = llvm::cas::getDefaultOnDiskCASPath();
790788

791789
if (const Arg *A = Args.getLastArg(OPT_cas_plugin_path))
792790
Opts.CASOpts.PluginPath = A->getValue();

lib/Frontend/Frontend.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,11 @@ bool CompilerInstance::setupCASIfNeeded(ArrayRef<const char *> Args) {
466466
return false;
467467

468468
const auto &Opts = getInvocation().getCASOptions();
469+
if (Opts.CASOpts.CASPath.empty() && Opts.CASOpts.PluginPath.empty()) {
470+
Diagnostics.diagnose(SourceLoc(), diag::error_cas_initialization,
471+
"no CAS options provided");
472+
return true;
473+
}
469474
auto MaybeDB = Opts.CASOpts.getOrCreateDatabases();
470475
if (!MaybeDB) {
471476
Diagnostics.diagnose(SourceLoc(), diag::error_cas_initialization,

test/CAS/cas_output_backend.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd
1414
// RUN: echo "\"-parse-stdlib\"" >> %t/MyApp.cmd
1515

16+
// RUN: not %target-swift-frontend -c -cache-compile-job %s -o %t/test.o @%t/MyApp.cmd 2>&1 | %FileCheck %s --check-prefix=NOT-CONFIG
17+
// NOT-CONFIG: error: CAS cannot be initialized from the specified '-cas-*' options: no CAS options provided
18+
1619
// RUN: %target-swift-frontend -c -cache-compile-job -cas-path %t/cas %s -o %t/test.o @%t/MyApp.cmd
1720
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \
1821
// RUN: %target-swift-frontend -c -cache-compile-job -cas-path %t/cas %s -o %t/test.o @%t/MyApp.cmd > %t/cache_key.json

0 commit comments

Comments
 (0)