Skip to content

Commit 91c4218

Browse files
committed
SIL: add Type.isHeapObjectReferenceType
1 parent 3038853 commit 91c4218

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

SwiftCompilerSources/Sources/SIL/Type.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ public struct Type : TypeProperties, CustomStringConvertible, NoReflectionChildr
9292
bridged.isExactSuperclassOf(type.bridged)
9393
}
9494

95+
/// True if this type references a "ref" type that has a single pointer representation.
96+
public var isHeapObjectReferenceType: Bool { bridged.isHeapObjectReferenceType() }
97+
9598
public func loweredInstanceTypeOfMetatype(in function: Function) -> Type {
9699
return canonicalType.instanceTypeOfMetatype.loweredType(in: function)
97100
}

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ struct BridgedType {
290290
BRIDGED_INLINE bool isEscapable(BridgedFunction f) const;
291291
BRIDGED_INLINE bool isExactSuperclassOf(BridgedType t) const;
292292
BRIDGED_INLINE bool isMarkedAsImmortal() const;
293+
BRIDGED_INLINE bool isHeapObjectReferenceType() const;
293294
BRIDGED_INLINE bool isAddressableForDeps(BridgedFunction f) const;
294295
BRIDGED_INLINE SWIFT_IMPORT_UNSAFE BridgedASTType getRawLayoutSubstitutedLikeType() const;
295296
BRIDGED_INLINE SWIFT_IMPORT_UNSAFE BridgedASTType getRawLayoutSubstitutedCountType() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ bool BridgedType::isMarkedAsImmortal() const {
398398
return unbridged().isMarkedAsImmortal();
399399
}
400400

401+
bool BridgedType::isHeapObjectReferenceType() const {
402+
return unbridged().isHeapObjectReferenceType();
403+
}
404+
401405
bool BridgedType::isAddressableForDeps(BridgedFunction f) const {
402406
return unbridged().isAddressableForDeps(*f.getFunction());
403407
}

0 commit comments

Comments
 (0)