Skip to content

Commit 94e8ddc

Browse files
Merge pull request #67041 from cachemeifyoucan/eng/PR-fix-cas-depscan-edge-cases
[DepScan][CAS] Fix some cases in cas-based depscanning
2 parents 5383c6d + dfd11cf commit 94e8ddc

File tree

7 files changed

+28
-18
lines changed

7 files changed

+28
-18
lines changed

lib/ClangImporter/ClangModuleDependencyScanner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void ClangImporter::recordModuleDependencies(
238238
clangModuleDep.IncludeTreeID ? *clangModuleDep.IncludeTreeID : "";
239239

240240
if (ctx.ClangImporterOpts.CASOpts) {
241-
swiftArgs.push_back("-enable-cas");
241+
swiftArgs.push_back("-cache-compile-job");
242242
if (!ctx.ClangImporterOpts.CASOpts->CASPath.empty()) {
243243
swiftArgs.push_back("-cas-path");
244244
swiftArgs.push_back(ctx.ClangImporterOpts.CASOpts->CASPath);
@@ -345,7 +345,7 @@ void ClangImporter::recordBridgingHeaderOptions(
345345
llvm::for_each(clangArgs, addClangArg);
346346

347347
if (ctx.ClangImporterOpts.CASOpts) {
348-
swiftArgs.push_back("-enable-cas");
348+
swiftArgs.push_back("-cache-compile-job");
349349
if (!ctx.ClangImporterOpts.CASOpts->CASPath.empty()) {
350350
swiftArgs.push_back("-cas-path");
351351
swiftArgs.push_back(ctx.ClangImporterOpts.CASOpts->CASPath);

lib/DependencyScan/ScanDependencies.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,20 +1016,6 @@ static void writeJSON(llvm::raw_ostream &out,
10161016
5,
10171017
/*trailingComma=*/true);
10181018
out.indent(5 * 2);
1019-
out << "\"commandLine\": [\n";
1020-
for (int i = 0, count = swiftTextualDeps->command_line->count;
1021-
i < count; ++i) {
1022-
const auto &arg =
1023-
get_C_string(swiftTextualDeps->command_line->strings[i]);
1024-
out.indent(6 * 2);
1025-
out << "\"" << quote(arg) << "\"";
1026-
if (i != count - 1)
1027-
out << ",";
1028-
out << "\n";
1029-
}
1030-
out.indent(5 * 2);
1031-
out << "],\n";
1032-
out.indent(5 * 2);
10331019
out << "\"compiledModuleCandidates\": [\n";
10341020
for (int i = 0,
10351021
count = swiftTextualDeps->compiled_module_candidates->count;
@@ -1045,6 +1031,20 @@ static void writeJSON(llvm::raw_ostream &out,
10451031
out.indent(5 * 2);
10461032
out << "],\n";
10471033
}
1034+
out.indent(5 * 2);
1035+
out << "\"commandLine\": [\n";
1036+
for (int i = 0, count = swiftTextualDeps->command_line->count; i < count;
1037+
++i) {
1038+
const auto &arg =
1039+
get_C_string(swiftTextualDeps->command_line->strings[i]);
1040+
out.indent(6 * 2);
1041+
out << "\"" << quote(arg) << "\"";
1042+
if (i != count - 1)
1043+
out << ",";
1044+
out << "\n";
1045+
}
1046+
out.indent(5 * 2);
1047+
out << "],\n";
10481048
bool hasBridgingHeaderPath =
10491049
swiftTextualDeps->bridging_header_path.data &&
10501050
get_C_string(swiftTextualDeps->bridging_header_path)[0] != '\0';

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
16041604
if (clangImporterOpts.CASOpts) {
16051605
genericSubInvocation.getClangImporterOptions().CASOpts =
16061606
clangImporterOpts.CASOpts;
1607-
GenericArgs.push_back("-enable-cas");
1607+
GenericArgs.push_back("-cache-compile-job");
16081608
if (!clangImporterOpts.CASOpts->CASPath.empty()) {
16091609
GenericArgs.push_back("-cas-path");
16101610
GenericArgs.push_back(clangImporterOpts.CASOpts->CASPath);

test/CAS/module_deps.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ import SubE
6666
// CHECK-DAG: "swift": "_Concurrency"
6767
// CHECK-DAG: "swift": "_cross_import_E"
6868
// CHECK: ],
69-
69+
// CHECK: "commandLine":
70+
// CHECK: "casFSRootID":
7071
// CHECK: "extraPcmArgs": [
7172
// CHECK-NEXT: "-Xcc",
7273
// CHECK-NEXT: "-target",
@@ -124,6 +125,8 @@ import SubE
124125
// CHECK: "commandLine": [
125126
// CHECK: "-compile-module-from-interface"
126127
// CHECK: "-target"
128+
// CHECK: "-cache-compile-job"
129+
// CHECK: "-cas-path"
127130
// CHECK: "-module-name"
128131
// CHECK: "G"
129132
// CHECK: "-swift-version"

test/CAS/module_deps_include_tree.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ import SubE
119119
// CHECK: "commandLine": [
120120
// CHECK: "-compile-module-from-interface"
121121
// CHECK: "-target"
122+
// CHECK: "-cache-compile-job"
123+
// CHECK: "-cas-path"
122124
// CHECK: "-module-name"
123125
// CHECK: "G"
124126
// CHECK: "-swift-version"

test/ModuleInterface/clang-session-transitive.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ import TestModule
3333
// CHECK-NEXT: "swift": {
3434
// CHECK-NEXT: "moduleInterfacePath":
3535
// CHECK-NEXT: "contextHash":
36+
// CHECK-NEXT: "compiledModuleCandidates": [
37+
// CHECK-NEXT: TestModule.swiftmodule
38+
// CHECK-NEXT: ],
3639
// CHECK-NEXT: "commandLine": [
3740
// CHECK-NEXT: "-frontend",
3841
// CHECK-NEXT: "-compile-module-from-interface",

test/ModuleInterface/extension-transitive-availability.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ func foo() {
4242
// CHECK-NEXT: "swift": {
4343
// CHECK-NEXT: "moduleInterfacePath":
4444
// CHECK-NEXT: "contextHash":
45+
// CHECK-NEXT: "compiledModuleCandidates": [
46+
// CHECK-NEXT: ],
4547
// CHECK-NEXT: "commandLine": [
4648
// CHECK-NEXT: "-frontend",
4749
// CHECK-NEXT: "-compile-module-from-interface",

0 commit comments

Comments
 (0)