forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request swiftlang#78188 from tshortli/silgen-name-linkage-6.1
[6.1] SIL: Always give `@_silgen_name` forward declarations public linkage
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// RUN: %target-swift-frontend -parse-as-library -emit-ir %s | %FileCheck %s | ||
|
||
// Since this test depends on weak linking based on availability, it only | ||
// applies to Apple platforms. | ||
// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos || OS=visionos | ||
|
||
@available(SwiftStdlib 9999, *) | ||
@_silgen_name("privateForwardDecl") | ||
private func privateForwardDecl() | ||
|
||
@available(SwiftStdlib 9999, *) | ||
@_silgen_name("internalForwardDecl") | ||
internal func internalForwardDecl() | ||
|
||
@available(SwiftStdlib 9999, *) | ||
@_silgen_name("publicForwardDecl") | ||
public func publicForwardDecl() | ||
|
||
@available(SwiftStdlib 9999, *) | ||
@_silgen_name("privateDefined") | ||
private func privateDefined() {} | ||
|
||
// CHECK: define internal swiftcc void @privateDefined() | ||
|
||
@available(SwiftStdlib 9999, *) | ||
@_silgen_name("internalDefined") | ||
internal func internalDefined() {} | ||
|
||
// CHECK: define hidden swiftcc void @internalDefined() | ||
|
||
@available(SwiftStdlib 9999, *) | ||
@_silgen_name("publicDefined") | ||
public func publicDefined() {} | ||
|
||
// CHECK: define swiftcc void @publicDefined() | ||
|
||
public func test() { | ||
guard #available(SwiftStdlib 9999, *) else { return } | ||
privateForwardDecl() | ||
internalForwardDecl() | ||
publicForwardDecl() | ||
privateDefined() | ||
internalDefined() | ||
publicDefined() | ||
} | ||
|
||
// CHECK: declare extern_weak swiftcc void @privateForwardDecl() | ||
// CHECK: declare extern_weak swiftcc void @internalForwardDecl() | ||
// CHECK: declare extern_weak swiftcc void @publicForwardDecl() |