@@ -3644,14 +3644,12 @@ class DeclDeserializer {
36443644 assert (bodyParams && " missing parameters for constructor" );
36453645 ctor->setParameters (bodyParams);
36463646
3647- SmallVector<LifetimeDependenceSpecifier> specifierList;
3648- if (MF.maybeReadLifetimeDependenceSpecifier (specifierList,
3649- bodyParams->size ())) {
3650- auto SelfType = ctor->getDeclaredInterfaceType ();
3651- auto typeRepr = new (ctx) FixedTypeRepr (SelfType, SourceLoc ());
3652- auto lifetimeTypeRepr =
3653- LifetimeDependentReturnTypeRepr::create (ctx, typeRepr, specifierList);
3654- ctor->setDeserializedResultTypeLoc (TypeLoc (lifetimeTypeRepr, SelfType));
3647+ auto lifetimeDependenceInfo =
3648+ MF.maybeReadLifetimeDependenceInfo (bodyParams->size ());
3649+
3650+ if (lifetimeDependenceInfo.has_value ()) {
3651+ ctx.evaluator .cacheOutput (LifetimeDependenceInfoRequest{ctor},
3652+ std::move (lifetimeDependenceInfo.value ()));
36553653 }
36563654
36573655 if (auto errorConvention = MF.maybeReadForeignErrorConvention ())
@@ -4222,13 +4220,13 @@ class DeclDeserializer {
42224220
42234221 ParameterList *paramList = MF.readParameterList ();
42244222 fn->setParameters (paramList);
4225- SmallVector<LifetimeDependenceSpecifier> specifierList;
4226- if (MF. maybeReadLifetimeDependenceSpecifier (specifierList,
4227- paramList->size ())) {
4228- auto typeRepr = new (ctx) FixedTypeRepr (resultType, SourceLoc ());
4229- auto lifetimeTypeRepr =
4230- LifetimeDependentReturnTypeRepr::create ( ctx, typeRepr, specifierList);
4231- fn-> setDeserializedResultTypeLoc ( TypeLoc (lifetimeTypeRepr, resultType ));
4223+
4224+ auto lifetimeDependenceInfo =
4225+ MF. maybeReadLifetimeDependenceInfo ( paramList->size ());
4226+
4227+ if (lifetimeDependenceInfo. has_value ()) {
4228+ ctx. evaluator . cacheOutput (LifetimeDependenceInfoRequest{fn},
4229+ std::move (lifetimeDependenceInfo. value () ));
42324230 }
42334231
42344232 if (auto errorConvention = MF.maybeReadForeignErrorConvention ())
@@ -8829,41 +8827,3 @@ ModuleFile::maybeReadLifetimeDependenceInfo(unsigned numParams) {
88298827 ? IndexSubset::get (ctx, scopeLifetimeParamIndices)
88308828 : nullptr );
88318829}
8832-
8833- bool ModuleFile::maybeReadLifetimeDependenceSpecifier (
8834- SmallVectorImpl<LifetimeDependenceSpecifier> &specifierList,
8835- unsigned numDeclParams) {
8836- using namespace decls_block ;
8837-
8838- SmallVector<uint64_t , 8 > scratch;
8839- if (!maybeReadLifetimeDependenceRecord (scratch)) {
8840- return false ;
8841- }
8842-
8843- bool hasInheritLifetimeParamIndices;
8844- bool hasScopeLifetimeParamIndices;
8845- ArrayRef<uint64_t > lifetimeDependenceData;
8846- LifetimeDependenceLayout::readRecord (scratch, hasInheritLifetimeParamIndices,
8847- hasScopeLifetimeParamIndices,
8848- lifetimeDependenceData);
8849-
8850- unsigned startIndex = 0 ;
8851- auto pushData = [&](ParsedLifetimeDependenceKind kind) {
8852- for (unsigned i = 0 ; i < numDeclParams + 1 ; i++) {
8853- if (lifetimeDependenceData[startIndex + i]) {
8854- specifierList.push_back (
8855- LifetimeDependenceSpecifier::getOrderedLifetimeDependenceSpecifier (
8856- SourceLoc (), kind, i));
8857- }
8858- }
8859- startIndex += numDeclParams + 1 ;
8860- };
8861-
8862- if (hasInheritLifetimeParamIndices) {
8863- pushData (ParsedLifetimeDependenceKind::Inherit);
8864- }
8865- if (hasScopeLifetimeParamIndices) {
8866- pushData (ParsedLifetimeDependenceKind::Scope);
8867- }
8868- return true ;
8869- }
0 commit comments