File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
SwiftCompilerSources/Sources/SIL Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ extension Context {
4848
4949 public func getBuiltinIntegerType( bitWidth: Int ) -> Type { _bridged. getBuiltinIntegerType ( bitWidth) . type }
5050
51+ public func getTupleType( elements: [ Type ] ) -> AST . `Type` {
52+ let bridgedElements = elements. map { $0. bridged }
53+ return bridgedElements. withBridgedArrayRef {
54+ AST . `Type` ( bridged: _bridged. getTupleType ( $0) )
55+ }
56+ }
57+
5158 public var swiftArrayDecl : NominalTypeDecl {
5259 _bridged. getSwiftArrayDecl ( ) . getAs ( NominalTypeDecl . self)
5360 }
Original file line number Diff line number Diff line change @@ -1425,6 +1425,7 @@ struct BridgedContext {
14251425 SWIFT_IMPORT_UNSAFE OptionalBridgedFunction lookUpNominalDeinitFunction (BridgedDeclObj nominal) const ;
14261426 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap getContextSubstitutionMap (BridgedType type) const ;
14271427 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType getBuiltinIntegerType (SwiftInt bitWidth) const ;
1428+ SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getTupleType (BridgedArrayRef elementTypes) const ;
14281429 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedDeclObj getSwiftArrayDecl () const ;
14291430 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedDeclObj getSwiftMutableSpanDecl () const ;
14301431 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedValue getSILUndef (BridgedType type) const ;
Original file line number Diff line number Diff line change @@ -2847,6 +2847,14 @@ BridgedType BridgedContext::getBuiltinIntegerType(SwiftInt bitWidth) const {
28472847 return swift::SILType::getBuiltinIntegerType (bitWidth, context->getModule ()->getASTContext ());
28482848}
28492849
2850+ BridgedASTType BridgedContext::getTupleType (BridgedArrayRef elementTypes) const {
2851+ llvm::SmallVector<swift::TupleTypeElt, 8 > elements;
2852+ for (auto bridgedElmtTy : elementTypes.unbridged <BridgedASTType>()) {
2853+ elements.push_back (bridgedElmtTy.unbridged ());
2854+ }
2855+ return {swift::TupleType::get (elements, context->getModule ()->getASTContext ())};
2856+ }
2857+
28502858BridgedDeclObj BridgedContext::getSwiftArrayDecl () const {
28512859 return {context->getModule ()->getASTContext ().getArrayDecl ()};
28522860}
You can’t perform that action at this time.
0 commit comments