@@ -176,6 +176,7 @@ class LifetimeDependenceInfo {
176176 return copyLifetimeParamIndices == nullptr &&
177177 borrowLifetimeParamIndices == nullptr ;
178178 }
179+ std::string getString () const ;
179180};
180181
181182// MARK: - UnexpectedClangTypeError
@@ -922,11 +923,15 @@ class SILExtInfoBuilder {
922923
923924 ClangTypeInfo clangTypeInfo;
924925
926+ LifetimeDependenceInfo lifetimeDependenceInfo;
927+
925928 using Language = SILFunctionLanguage;
926929 using Representation = SILFunctionTypeRepresentation;
927930
928- SILExtInfoBuilder (unsigned bits, ClangTypeInfo clangTypeInfo)
929- : bits(bits), clangTypeInfo(clangTypeInfo.getCanonical()) {}
931+ SILExtInfoBuilder (unsigned bits, ClangTypeInfo clangTypeInfo,
932+ LifetimeDependenceInfo lifetimeDependenceInfo)
933+ : bits(bits), clangTypeInfo(clangTypeInfo.getCanonical()),
934+ lifetimeDependenceInfo (lifetimeDependenceInfo) {}
930935
931936 static constexpr unsigned makeBits (Representation rep, bool isPseudogeneric,
932937 bool isNoEscape, bool isSendable,
@@ -948,23 +953,24 @@ class SILExtInfoBuilder {
948953 : SILExtInfoBuilder(makeBits(SILFunctionTypeRepresentation::Thick, false ,
949954 false , false , false , false ,
950955 DifferentiabilityKind::NonDifferentiable),
951- ClangTypeInfo (nullptr )) {}
956+ ClangTypeInfo(nullptr ), LifetimeDependenceInfo() ) {}
952957
953958 SILExtInfoBuilder (Representation rep, bool isPseudogeneric, bool isNoEscape,
954959 bool isSendable, bool isAsync, bool isUnimplementable,
955- DifferentiabilityKind diffKind, const clang::Type *type)
956- : SILExtInfoBuilder(makeBits(rep, isPseudogeneric, isNoEscape,
957- isSendable, isAsync, isUnimplementable ,
958- diffKind),
959- ClangTypeInfo(type)) {}
960+ DifferentiabilityKind diffKind, const clang::Type *type,
961+ LifetimeDependenceInfo lifetimeDependenceInfo)
962+ : SILExtInfoBuilder(makeBits(rep, isPseudogeneric, isNoEscape, isSendable ,
963+ isAsync, isUnimplementable, diffKind),
964+ ClangTypeInfo(type), lifetimeDependenceInfo ) {}
960965
961966 // Constructor for polymorphic type.
962967 SILExtInfoBuilder (ASTExtInfoBuilder info, bool isPseudogeneric)
963968 : SILExtInfoBuilder(makeBits(info.getSILRepresentation(), isPseudogeneric,
964969 info.isNoEscape(), info.isSendable(),
965970 info.isAsync(), /* unimplementable*/ false,
966971 info.getDifferentiabilityKind()),
967- info.getClangTypeInfo()) {}
972+ info.getClangTypeInfo(),
973+ info.getLifetimeDependenceInfo()) {}
968974
969975 void checkInvariants () const ;
970976
@@ -1008,6 +1014,10 @@ class SILExtInfoBuilder {
10081014 // / Get the underlying ClangTypeInfo value.
10091015 ClangTypeInfo getClangTypeInfo () const { return clangTypeInfo; }
10101016
1017+ LifetimeDependenceInfo getLifetimeDependenceInfo () const {
1018+ return lifetimeDependenceInfo;
1019+ }
1020+
10111021 constexpr bool hasSelfParam () const {
10121022 switch (getRepresentation ()) {
10131023 case Representation::Thick:
@@ -1057,50 +1067,55 @@ class SILExtInfoBuilder {
10571067 SILExtInfoBuilder withRepresentation (Representation rep) const {
10581068 return SILExtInfoBuilder ((bits & ~RepresentationMask) | (unsigned )rep,
10591069 shouldStoreClangType (rep) ? clangTypeInfo
1060- : ClangTypeInfo ());
1070+ : ClangTypeInfo (),
1071+ lifetimeDependenceInfo);
10611072 }
10621073 [[nodiscard]]
10631074 SILExtInfoBuilder withIsPseudogeneric (bool isPseudogeneric = true ) const {
10641075 return SILExtInfoBuilder (isPseudogeneric ? (bits | PseudogenericMask)
10651076 : (bits & ~PseudogenericMask),
1066- clangTypeInfo);
1077+ clangTypeInfo, lifetimeDependenceInfo );
10671078 }
10681079 [[nodiscard]]
10691080 SILExtInfoBuilder withNoEscape (bool noEscape = true ) const {
10701081 return SILExtInfoBuilder (noEscape ? (bits | NoEscapeMask)
10711082 : (bits & ~NoEscapeMask),
1072- clangTypeInfo);
1083+ clangTypeInfo, lifetimeDependenceInfo );
10731084 }
10741085 [[nodiscard]]
10751086 SILExtInfoBuilder withConcurrent (bool isSendable = true ) const {
10761087 return SILExtInfoBuilder (isSendable ? (bits | SendableMask)
1077- : (bits & ~SendableMask),
1078- clangTypeInfo);
1088+ : (bits & ~SendableMask),
1089+ clangTypeInfo, lifetimeDependenceInfo );
10791090 }
10801091 [[nodiscard]]
10811092 SILExtInfoBuilder withAsync (bool isAsync = true ) const {
10821093 return SILExtInfoBuilder (isAsync ? (bits | AsyncMask) : (bits & ~AsyncMask),
1083- clangTypeInfo);
1094+ clangTypeInfo, lifetimeDependenceInfo );
10841095 }
10851096 [[nodiscard]]
10861097 SILExtInfoBuilder withUnimplementable (bool isUnimplementable = true ) const {
10871098 return SILExtInfoBuilder (isUnimplementable ? (bits | UnimplementableMask)
10881099 : (bits & ~UnimplementableMask),
1089- clangTypeInfo);
1100+ clangTypeInfo, lifetimeDependenceInfo );
10901101 }
10911102 [[nodiscard]]
10921103 SILExtInfoBuilder
10931104 withDifferentiabilityKind (DifferentiabilityKind differentiability) const {
10941105 return SILExtInfoBuilder (
10951106 (bits & ~DifferentiabilityMask) |
10961107 ((unsigned )differentiability << DifferentiabilityMaskOffset),
1097- clangTypeInfo);
1108+ clangTypeInfo, lifetimeDependenceInfo );
10981109 }
10991110 [[nodiscard]]
11001111 SILExtInfoBuilder withClangFunctionType (const clang::Type *type) const {
1101- return SILExtInfoBuilder (bits, ClangTypeInfo (type).getCanonical ());
1112+ return SILExtInfoBuilder (bits, ClangTypeInfo (type).getCanonical (),
1113+ lifetimeDependenceInfo);
1114+ }
1115+ [[nodiscard]] SILExtInfoBuilder withLifetimeDependenceInfo (
1116+ LifetimeDependenceInfo lifetimeDependenceInfo) const {
1117+ return SILExtInfoBuilder (bits, clangTypeInfo, lifetimeDependenceInfo);
11021118 }
1103-
11041119
11051120 bool isEqualTo (SILExtInfoBuilder other, bool useClangTypes) const {
11061121 return bits == other.bits &&
@@ -1129,8 +1144,9 @@ class SILExtInfo {
11291144 // Only for use by SILExtInfoBuilder::build. Don't use it elsewhere!
11301145 SILExtInfo (SILExtInfoBuilder builder) : builder(builder) {}
11311146
1132- SILExtInfo (unsigned bits, ClangTypeInfo clangTypeInfo)
1133- : builder(bits, clangTypeInfo) {
1147+ SILExtInfo (unsigned bits, ClangTypeInfo clangTypeInfo,
1148+ LifetimeDependenceInfo lifetimeDependenceInfo)
1149+ : builder(bits, clangTypeInfo, lifetimeDependenceInfo) {
11341150 builder.checkInvariants ();
11351151 };
11361152
@@ -1148,7 +1164,8 @@ class SILExtInfo {
11481164 static SILExtInfo getThin () {
11491165 return SILExtInfoBuilder (SILExtInfoBuilder::Representation::Thin, false ,
11501166 false , false , false , false ,
1151- DifferentiabilityKind::NonDifferentiable, nullptr )
1167+ DifferentiabilityKind::NonDifferentiable, nullptr ,
1168+ LifetimeDependenceInfo ())
11521169 .build ();
11531170 }
11541171
@@ -1187,6 +1204,10 @@ class SILExtInfo {
11871204
11881205 ClangTypeInfo getClangTypeInfo () const { return builder.getClangTypeInfo (); }
11891206
1207+ LifetimeDependenceInfo getLifetimeDependenceInfo () const {
1208+ return builder.getLifetimeDependenceInfo ();
1209+ }
1210+
11901211 constexpr bool hasSelfParam () const { return builder.hasSelfParam (); }
11911212
11921213 constexpr bool hasContext () const { return builder.hasContext (); }
0 commit comments