Skip to content

Commit 1778a76

Browse files
committed
NFC: Add a short test case demonstrating that inlining currently bypasses @_weakLinked import.
1 parent fb411c8 commit 1778a76

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

test/IRGen/Inputs/weaklinked_import_helper.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
public func fn() {}
22

3+
@usableFromInline
4+
func usableFromInlineFn() {}
5+
6+
@_alwaysEmitIntoClient
7+
public func alwaysEmitIntoClientFn() {
8+
usableFromInlineFn()
9+
}
10+
311
public var globalStored = 0
412

513
public var globalComputed: Int {

test/IRGen/weaklinked_import.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,12 @@ protocol RefinesP: BaseP {}
157157
// CHECK-DAG: @"$s24weaklinked_import_helper1SVAA5BasePAAWP" = extern_weak global i8*
158158
// CHECK-DAG: @"$s24weaklinked_import_helper1SVMn" = extern_weak global %swift.type_descriptor
159159
extension S: RefinesP {}
160+
161+
func testInlining() {
162+
// FIXME: usableFromInlineFn() should be extern_weak but isn't because
163+
// inlining doesn't respect @_weakLinked import yet.
164+
165+
// CHECK-DAG: define linkonce_odr hidden {{.+}} @"$s24weaklinked_import_helper22alwaysEmitIntoClientFnyyF"()
166+
// CHECK-DAG: declare swiftcc {{.+}} @"$s24weaklinked_import_helper18usableFromInlineFnyyF"
167+
alwaysEmitIntoClientFn()
168+
}

0 commit comments

Comments
 (0)