Skip to content

Commit 6c60f03

Browse files
committed
SIL: Split up Function.loweredFunctionType/InContext
1 parent 11f727e commit 6c60f03

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,19 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
6060

6161
public var hasLoweredAddresses: Bool { bridged.hasLoweredAddresses() }
6262

63-
/// The lowered function type in the expansion context of self.
63+
public var loweredFunctionType: CanonicalType {
64+
CanonicalType(bridged: bridged.getLoweredFunctionType())
65+
}
66+
67+
/// The lowered function type, with opaque archetypes erased.
6468
///
65-
/// Always expanding a function type means that the opaque result types
66-
/// have the correct generic signature. For example:
69+
/// For example:
6770
/// @substituted <τ_0_0> () -> @out τ_0_0 for <some P>
6871
/// is lowered to this inside its module:
6972
/// @substituted <τ_0_0> () -> @out τ_0_0 for <ActualResultType>
7073
/// and this outside its module
7174
/// @substituted <τ_0_0> () -> @out τ_0_0 for <some P>
72-
public var loweredFunctionType: CanonicalType {
75+
public var loweredFunctionTypeInContext: CanonicalType {
7376
CanonicalType(bridged: bridged.getLoweredFunctionTypeInContext())
7477
}
7578

@@ -354,7 +357,7 @@ public func != (lhs: Function, rhs: Function) -> Bool { lhs !== rhs }
354357
// Function conventions.
355358
extension Function {
356359
public var convention: FunctionConvention {
357-
FunctionConvention(for: loweredFunctionType, in: self)
360+
FunctionConvention(for: loweredFunctionTypeInContext, in: self)
358361
}
359362

360363
public var argumentConventions: ArgumentConventions {

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ struct BridgedFunction {
486486
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef getAccessorName() const;
487487
BRIDGED_INLINE bool hasOwnership() const;
488488
BRIDGED_INLINE bool hasLoweredAddresses() const;
489+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType getLoweredFunctionType() const;
489490
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType getLoweredFunctionTypeInContext() const;
490491
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGenericSignature getGenericSignature() const;
491492
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap getForwardingSubstitutionMap() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@ bool BridgedFunction::hasOwnership() const { return getFunction()->hasOwnership(
705705

706706
bool BridgedFunction::hasLoweredAddresses() const { return getFunction()->getModule().useLoweredAddresses(); }
707707

708+
BridgedCanType BridgedFunction::getLoweredFunctionType() const {
709+
return getFunction()->getLoweredFunctionType();
710+
}
711+
708712
BridgedCanType BridgedFunction::getLoweredFunctionTypeInContext() const {
709713
return getFunction()->getLoweredFunctionTypeInContext();
710714
}

0 commit comments

Comments
 (0)