mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
subclassScope was always set as NotApplicable when deserialized but we
need to serialize and deserialize it to keep correct linkage when using
SIB
```swift
open class Visitor {
public func visit() {
visitExprImpl()
}
@_optimize(none)
private func visitExprImpl() {
}
}
```
In this case, `visitExprImpl` is private but subclassScope is External.
So it should be lowered as an external function at LLVM IR level.
But once it's serialized into SIB, subclassScope of `visitExprImpl` was
deserialized as NotApplicable because it was not serialized. This
mismatch makes `visitExprImpl` lowered as an internal function at LLVM
IR level.
So `subclassScope` should be serialized.
20 lines
897 B
Swift
20 lines
897 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix DIRECT-CHECK
|
|
// RUN: %target-swift-frontend -emit-sib %s -o %t/access-level.sib
|
|
// RUN: %target-swift-frontend -emit-ir %t/access-level.sib | %FileCheck %s --check-prefix FROM-SIB-CHECK
|
|
|
|
// Ensure that the method linkage is default external when lowered from .swift directly
|
|
// DIRECT-CHECK-NOT: define{{.*}}internal{{.*}}swiftcc{{.*}}void @"$s4main7VisitorC13visitExprImpl33_205B03B83823935B4865F4617387553BLLyyF"
|
|
|
|
// Ensure that the method linkage is default external when lowered from .swift -> .sib -> .ll
|
|
// FROM-SIB-CHECK-NOT: define{{.*}}internal{{.*}}swiftcc{{.*}}void @"$s4main7VisitorC13visitExprImpl33_205B03B83823935B4865F4617387553BLLyyF"
|
|
|
|
open class Visitor {
|
|
public func visit() {
|
|
visitExprImpl()
|
|
}
|
|
@_optimize(none)
|
|
private func visitExprImpl() {
|
|
}
|
|
}
|