Skip to content

Commit ee1426b

Browse files
Merge pull request #72459 from cachemeifyoucan/eng/PR-119202702
[ScanDependency] Set context hash for source module
2 parents 22a37e3 + f71cce1 commit ee1426b

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
@@ -816,9 +816,6 @@ static void writeJSON(llvm::raw_ostream &out,
816816
if (!moduleInterfacePath.empty()) {
817817
writeJSONSingleField(out, "moduleInterfacePath", moduleInterfacePath, 5,
818818
/*trailingComma=*/true);
819-
writeJSONSingleField(out, "contextHash", swiftTextualDeps->context_hash,
820-
5,
821-
/*trailingComma=*/true);
822819
out.indent(5 * 2);
823820
out << "\"compiledModuleCandidates\": [\n";
824821
for (int i = 0,
@@ -849,6 +846,9 @@ static void writeJSON(llvm::raw_ostream &out,
849846
}
850847
out.indent(5 * 2);
851848
out << "],\n";
849+
writeJSONSingleField(out, "contextHash", swiftTextualDeps->context_hash,
850+
5,
851+
/*trailingComma=*/true);
852852
bool hasBridgingHeaderPath =
853853
swiftTextualDeps->bridging_header_path.data &&
854854
get_C_string(swiftTextualDeps->bridging_header_path)[0] != '\0';
@@ -1244,9 +1244,7 @@ generateFullDependencyGraph(const CompilerInstance &instance,
12441244
bridgedOverlayDependencyNames);
12451245

12461246
details->swift_textual_details = {
1247-
moduleInterfacePath,
1248-
create_empty_set(),
1249-
bridgingHeaderPath,
1247+
moduleInterfacePath, create_empty_set(), bridgingHeaderPath,
12501248
create_set(
12511249
swiftSourceDeps->textualModuleDetails.bridgingSourceFiles),
12521250
create_set(swiftSourceDeps->textualModuleDetails
@@ -1255,7 +1253,9 @@ generateFullDependencyGraph(const CompilerInstance &instance,
12551253
create_set(swiftSourceDeps->textualModuleDetails.buildCommandLine),
12561254
create_set(swiftSourceDeps->bridgingHeaderBuildCommandLine),
12571255
create_set(swiftSourceDeps->textualModuleDetails.extraPCMArgs),
1258-
/*contextHash*/ create_null(),
1256+
/*contextHash*/
1257+
create_clone(
1258+
instance.getInvocation().getModuleScanningHash().c_str()),
12591259
/*isFramework*/ false,
12601260
/*CASFS*/
12611261
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)