Skip to content

Commit c25d2af

Browse files
Merge pull request #79022 from cachemeifyoucan/eng/PR-bridging-header-swift-overlays
[ScanDependency] Fix a corner case for swift overlay module discovery
2 parents 63c2979 + 8b02532 commit c25d2af

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

lib/AST/ModuleDependencies.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ ModuleDependenciesCache::getClangDependencies(const ModuleDependencyID &moduleID
962962
auto clangImportedDepsRef = moduleInfo.getImportedClangDependencies();
963963
result.insert(clangImportedDepsRef.begin(),
964964
clangImportedDepsRef.end());
965-
if (moduleInfo.isSwiftSourceModule()) {
965+
if (moduleInfo.isSwiftSourceModule() || moduleInfo.isSwiftBinaryModule()) {
966966
auto headerClangDepsRef = moduleInfo.getHeaderClangDependencies();
967967
result.insert(headerClangDepsRef.begin(),
968968
headerClangDepsRef.end());
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// REQUIRES: objc_interop
2+
// RUN: %empty-directory(%t)
3+
// RUN: split-file %s %t
4+
5+
// RUN: %target-swift-frontend -emit-module -o %t/B.framework/Modules/B.swiftmodule/%target-swiftmodule-name -module-name B \
6+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
7+
// RUN: -I %t -F %t -import-objc-header %t/Bridging.h \
8+
// RUN: %t/B.swift
9+
10+
// RUN: %target-swift-frontend -emit-module -o %t/A.framework/Modules/A.swiftmodule/%target-swiftmodule-name -module-name A \
11+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
12+
// RUN: -I %t -F %t -import-objc-header %t/Bridging2.h \
13+
// RUN: %t/A.swift
14+
15+
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache -O \
16+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
17+
// RUN: %t/user.swift -o %t/deps.json -import-objc-header %t/Bridging3.h \
18+
// RUN: -I %t -F %t
19+
20+
// RUN: %FileCheck %s --input-file=%t/deps.json
21+
// CHECK-DAG: "swiftPrebuiltExternal": "A"
22+
// CHECK-DAG: "swiftPrebuiltExternal": "B"
23+
24+
//--- A.swift
25+
@_exported import A
26+
public func testA() {}
27+
28+
//--- B.swift
29+
@_exported import B
30+
import C
31+
public func testB() {}
32+
33+
//--- user.swift
34+
public func skip() {}
35+
36+
//--- Bridging.h
37+
void nothing(void);
38+
39+
//--- Bridging2.h
40+
#include "B/B.h"
41+
42+
//--- Bridging3.h
43+
#include "A/A.h"
44+
45+
//--- A.framework/Headers/A.h
46+
struct A {
47+
int a;
48+
};
49+
50+
//--- B.framework/Headers/B.h
51+
void b(void);
52+
@interface B
53+
@end
54+
55+
//--- C.h
56+
void c(void);
57+
58+
//--- A.framework/Modules/module.modulemap
59+
framework module A {
60+
umbrella header "A.h"
61+
export *
62+
}
63+
64+
//--- B.framework/Modules/module.modulemap
65+
framework module B {
66+
umbrella header "B.h"
67+
export *
68+
}
69+
70+
//--- module.modulemap
71+
module C {
72+
header "C.h"
73+
export *
74+
}

0 commit comments

Comments
 (0)