Skip to content

Commit eeb7946

Browse files
committed
SIL: add rawLayoutSubstitutedLikeType and rawLayoutSubstitutedCountType in Type
1 parent c1258f5 commit eeb7946

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

SwiftCompilerSources/Sources/SIL/Type.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ public struct Type : TypeProperties, CustomStringConvertible, NoReflectionChildr
103103
bridged.isAddressableForDeps(function.bridged)
104104
}
105105

106+
/// If this is a raw layout type, returns the substituted like-type.
107+
public var rawLayoutSubstitutedLikeType: AST.`Type`? {
108+
.init(bridgedOrNil: bridged.getRawLayoutSubstitutedLikeType())
109+
}
110+
111+
/// If this is a raw layout type, returns the substituted count-type.
112+
public var rawLayoutSubstitutedCountType: AST.`Type`? {
113+
.init(bridgedOrNil: bridged.getRawLayoutSubstitutedCountType())
114+
}
115+
106116
//===--------------------------------------------------------------------===//
107117
// Properties of lowered `SILFunctionType`s
108118
//===--------------------------------------------------------------------===//

include/swift/SIL/SILBridging.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ struct BridgedType {
263263
BRIDGED_INLINE bool isExactSuperclassOf(BridgedType t) const;
264264
BRIDGED_INLINE bool isMarkedAsImmortal() const;
265265
BRIDGED_INLINE bool isAddressableForDeps(BridgedFunction f) const;
266+
BRIDGED_INLINE SWIFT_IMPORT_UNSAFE BridgedASTType getRawLayoutSubstitutedLikeType() const;
267+
BRIDGED_INLINE SWIFT_IMPORT_UNSAFE BridgedASTType getRawLayoutSubstitutedCountType() const;
266268
BRIDGED_INLINE SwiftInt getCaseIdxOfEnumType(BridgedStringRef name) const;
267269
static BRIDGED_INLINE SwiftInt getNumBoxFields(BridgedCanType boxTy);
268270
static SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType getBoxFieldType(BridgedCanType boxTy,

include/swift/SIL/SILBridgingImpl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,14 @@ bool BridgedType::isAddressableForDeps(BridgedFunction f) const {
377377
return unbridged().isAddressableForDeps(*f.getFunction());
378378
}
379379

380+
BridgedASTType BridgedType::getRawLayoutSubstitutedLikeType() const {
381+
return {unbridged().getRawLayoutSubstitutedLikeType().getPointer()};
382+
}
383+
384+
BridgedASTType BridgedType::getRawLayoutSubstitutedCountType() const {
385+
return {unbridged().getRawLayoutSubstitutedCountType().getPointer()};
386+
}
387+
380388
SwiftInt BridgedType::getCaseIdxOfEnumType(BridgedStringRef name) const {
381389
return unbridged().getCaseIdxOfEnumType(name.unbridged());
382390
}

0 commit comments

Comments
 (0)