Skip to content

Commit bf324e6

Browse files
[ScanDependency] Set context hash for source module
Set context hash for source module so swift-driver can use the hash to compute output path if needed. rdar://119202702 (cherry picked from commit f71cce1)
1 parent 9001085 commit bf324e6

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

lib/DependencyScan/ScanDependencies.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -823,9 +823,6 @@ static void writeJSON(llvm::raw_ostream &out,
823823
if (!moduleInterfacePath.empty()) {
824824
writeJSONSingleField(out, "moduleInterfacePath", moduleInterfacePath, 5,
825825
/*trailingComma=*/true);
826-
writeJSONSingleField(out, "contextHash", swiftTextualDeps->context_hash,
827-
5,
828-
/*trailingComma=*/true);
829826
out.indent(5 * 2);
830827
out << "\"compiledModuleCandidates\": [\n";
831828
for (int i = 0,
@@ -856,6 +853,9 @@ static void writeJSON(llvm::raw_ostream &out,
856853
}
857854
out.indent(5 * 2);
858855
out << "],\n";
856+
writeJSONSingleField(out, "contextHash", swiftTextualDeps->context_hash,
857+
5,
858+
/*trailingComma=*/true);
859859
bool hasBridgingHeaderPath =
860860
swiftTextualDeps->bridging_header_path.data &&
861861
get_C_string(swiftTextualDeps->bridging_header_path)[0] != '\0';
@@ -1251,9 +1251,7 @@ generateFullDependencyGraph(const CompilerInstance &instance,
12511251
bridgedOverlayDependencyNames);
12521252

12531253
details->swift_textual_details = {
1254-
moduleInterfacePath,
1255-
create_empty_set(),
1256-
bridgingHeaderPath,
1254+
moduleInterfacePath, create_empty_set(), bridgingHeaderPath,
12571255
create_set(
12581256
swiftSourceDeps->textualModuleDetails.bridgingSourceFiles),
12591257
create_set(swiftSourceDeps->textualModuleDetails
@@ -1262,7 +1260,9 @@ generateFullDependencyGraph(const CompilerInstance &instance,
12621260
create_set(swiftSourceDeps->textualModuleDetails.buildCommandLine),
12631261
create_set(swiftSourceDeps->bridgingHeaderBuildCommandLine),
12641262
create_set(swiftSourceDeps->textualModuleDetails.extraPCMArgs),
1265-
/*contextHash*/ create_null(),
1263+
/*contextHash*/
1264+
create_clone(
1265+
instance.getInvocation().getModuleScanningHash().c_str()),
12661266
/*isFramework*/ false,
12671267
/*CASFS*/
12681268
create_clone(swiftSourceDeps->textualModuleDetails

test/CAS/module_deps.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ import SubE
133133
// CHECK: ],
134134
// CHECK-NEXT: "details": {
135135

136-
// CHECK: "contextHash": "{{.*}}",
137136
// CHECK: "commandLine": [
138137
// CHECK: "-compile-module-from-interface"
139138
// CHECK: "-target"
@@ -144,6 +143,7 @@ import SubE
144143
// CHECK: "-swift-version"
145144
// CHECK: "5"
146145
// CHECK: ],
146+
// CHECK: "contextHash": "{{.*}}",
147147
// CHECK_NO_CLANG_TARGET: "extraPcmArgs": [
148148
// CHECK_NO_CLANG_TARGET-NEXT: "-Xcc",
149149
// CHECK_NO_CLANG_TARGET-NEXT: "-target",

test/CAS/module_deps_include_tree.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ import SubE
127127
// CHECK: ],
128128
// CHECK-NEXT: "details": {
129129

130-
// CHECK: "contextHash": "{{.*}}",
131130
// CHECK: "commandLine": [
132131
// CHECK: "-compile-module-from-interface"
133132
// CHECK: "-target"
@@ -138,6 +137,7 @@ import SubE
138137
// CHECK: "-swift-version"
139138
// CHECK: "5"
140139
// CHECK: ],
140+
// CHECK: "contextHash": "{{.*}}",
141141
// CHECK_NO_CLANG_TARGET: "extraPcmArgs": [
142142
// CHECK_NO_CLANG_TARGET-NEXT: "-Xcc",
143143
// CHECK_NO_CLANG_TARGET-NEXT: "-target",

test/CAS/plugin_cas.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ import SubE
115115
// CHECK: ],
116116
// CHECK-NEXT: "details": {
117117

118-
// CHECK: "contextHash": "{{.*}}",
119118
// CHECK: "commandLine": [
120119
// CHECK: "-compile-module-from-interface"
121120
// CHECK: "-target"
@@ -124,6 +123,7 @@ import SubE
124123
// CHECK: "-swift-version"
125124
// CHECK: "5"
126125
// CHECK: ],
126+
// CHECK: "contextHash": "{{.*}}",
127127
// CHECK_NO_CLANG_TARGET: "extraPcmArgs": [
128128
// CHECK_NO_CLANG_TARGET-NEXT: "-Xcc",
129129
// CHECK_NO_CLANG_TARGET-NEXT: "-target",

test/ModuleInterface/clang-session-transitive.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import TestModule
3333
// CHECK-NEXT: "details": {
3434
// CHECK-NEXT: "swift": {
3535
// CHECK-NEXT: "moduleInterfacePath":
36-
// CHECK-NEXT: "contextHash":
3736
// CHECK-NEXT: "compiledModuleCandidates": [
3837
// CHECK-NEXT: TestModule.swiftmodule
3938
// CHECK-NEXT: ],

test/ModuleInterface/extension-transitive-availability.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func foo() {
3434
// CHECK-NEXT: "details": {
3535
// CHECK-NEXT: "swift": {
3636
// CHECK-NEXT: "moduleInterfacePath":
37-
// CHECK-NEXT: "contextHash":
3837
// CHECK-NEXT: "compiledModuleCandidates": [
3938
// CHECK-NEXT: ],
4039
// CHECK-NEXT: "commandLine": [

test/ScanDependencies/module_deps.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import SubE
5757
// CHECK-DAG: "swift": "_cross_import_E"
5858
// CHECK: ],
5959

60+
// CHECK: "contextHash":
6061
// CHECK: "extraPcmArgs": [
6162
// CHECK-NEXT: "-Xcc",
6263
// CHECK-NEXT: "-target",

test/ScanDependencies/module_deps_cache_reuse.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import SubE
4444
// CHECK-DAG: "clang": "_SwiftConcurrencyShims"
4545
// CHECK: ],
4646

47+
// CHECK: "contextHash":
4748
// CHECK: "extraPcmArgs": [
4849
// CHECK-NEXT: "-Xcc",
4950
// CHECK-NEXT: "-target",
@@ -95,7 +96,6 @@ import SubE
9596
// CHECK: ],
9697
// CHECK-NEXT: "details": {
9798

98-
// CHECK: "contextHash": "{{.*}}",
9999
// CHECK: "commandLine": [
100100
// CHECK: "-compile-module-from-interface"
101101
// CHECK: "-target"
@@ -104,6 +104,7 @@ import SubE
104104
// CHECK: "-swift-version"
105105
// CHECK: "5"
106106
// CHECK: ],
107+
// CHECK: "contextHash": "{{.*}}",
107108
// CHECK" "extraPcmArgs": [
108109
// CHECK" "-target",
109110
// CHECK" "-fapinotes-swift-version=5"

0 commit comments

Comments
 (0)