Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,6 @@ static bool ParseCASArgs(CASOptions &Opts, ArgList &Args,
Opts.CacheSkipReplay |= Args.hasArg(OPT_cache_disable_replay);
if (const Arg *A = Args.getLastArg(OPT_cas_path))
Opts.CASOpts.CASPath = A->getValue();
else if (Opts.CASOpts.CASPath.empty())
Opts.CASOpts.CASPath = llvm::cas::getDefaultOnDiskCASPath();

if (const Arg *A = Args.getLastArg(OPT_cas_plugin_path))
Opts.CASOpts.PluginPath = A->getValue();
Expand Down
5 changes: 5 additions & 0 deletions lib/Frontend/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ bool CompilerInstance::setupCASIfNeeded(ArrayRef<const char *> Args) {
return false;

const auto &Opts = getInvocation().getCASOptions();
if (Opts.CASOpts.CASPath.empty() && Opts.CASOpts.PluginPath.empty()) {
Diagnostics.diagnose(SourceLoc(), diag::error_cas_initialization,
"no CAS options provided");
return true;
}
auto MaybeDB = Opts.CASOpts.getOrCreateDatabases();
if (!MaybeDB) {
Diagnostics.diagnose(SourceLoc(), diag::error_cas_initialization,
Expand Down
3 changes: 3 additions & 0 deletions test/CAS/cas_output_backend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd
// RUN: echo "\"-parse-stdlib\"" >> %t/MyApp.cmd

// 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
// NOT-CONFIG: error: CAS cannot be initialized from the specified '-cas-*' options: no CAS options provided

// RUN: %target-swift-frontend -c -cache-compile-job -cas-path %t/cas %s -o %t/test.o @%t/MyApp.cmd
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \
// RUN: %target-swift-frontend -c -cache-compile-job -cas-path %t/cas %s -o %t/test.o @%t/MyApp.cmd > %t/cache_key.json
Expand Down