Skip to content

Commit e944035

Browse files
committed
Serialize inferred lifetime dependence info as well
1 parent f71d7f5 commit e944035

File tree

4 files changed

+10
-24
lines changed

4 files changed

+10
-24
lines changed

include/swift/AST/LifetimeDependence.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ class LifetimeDependenceSpecifier {
133133
class LifetimeDependenceInfo {
134134
IndexSubset *inheritLifetimeParamIndices;
135135
IndexSubset *scopeLifetimeParamIndices;
136-
bool isExplicit;
137136

138137
static LifetimeDependenceInfo getForParamIndex(AbstractFunctionDecl *afd,
139138
unsigned index,
@@ -142,13 +141,11 @@ class LifetimeDependenceInfo {
142141
public:
143142
LifetimeDependenceInfo()
144143
: inheritLifetimeParamIndices(nullptr),
145-
scopeLifetimeParamIndices(nullptr), isExplicit(false) {}
144+
scopeLifetimeParamIndices(nullptr) {}
146145
LifetimeDependenceInfo(IndexSubset *inheritLifetimeParamIndices,
147-
IndexSubset *scopeLifetimeParamIndices,
148-
bool isExplicit = false)
146+
IndexSubset *scopeLifetimeParamIndices)
149147
: inheritLifetimeParamIndices(inheritLifetimeParamIndices),
150-
scopeLifetimeParamIndices(scopeLifetimeParamIndices),
151-
isExplicit(isExplicit) {
148+
scopeLifetimeParamIndices(scopeLifetimeParamIndices) {
152149
assert(!empty());
153150
assert(!inheritLifetimeParamIndices ||
154151
!inheritLifetimeParamIndices->isEmpty());
@@ -162,8 +159,6 @@ class LifetimeDependenceInfo {
162159
scopeLifetimeParamIndices == nullptr;
163160
}
164161

165-
bool isExplicitlySpecified() const { return isExplicit; }
166-
167162
bool hasInheritLifetimeParamIndices() const {
168163
return inheritLifetimeParamIndices != nullptr;
169164
}

lib/Sema/LifetimeDependence.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,7 @@ LifetimeDependenceInfo::fromTypeRepr(AbstractFunctionDecl *afd, Type resultType,
318318
: nullptr,
319319
scopeLifetimeParamIndices.any()
320320
? IndexSubset::get(ctx, scopeLifetimeParamIndices)
321-
: nullptr,
322-
/*isExplicit*/ true);
321+
: nullptr);
323322
}
324323

325324
// This utility is similar to its overloaded version that builds the
@@ -391,8 +390,7 @@ std::optional<LifetimeDependenceInfo> LifetimeDependenceInfo::fromTypeRepr(
391390
: nullptr,
392391
scopeLifetimeParamIndices.any()
393392
? IndexSubset::get(ctx, scopeLifetimeParamIndices)
394-
: nullptr,
395-
/*isExplicit*/ true);
393+
: nullptr);
396394
}
397395

398396
std::optional<LifetimeDependenceInfo>

lib/Serialization/Serialization.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,10 +2552,7 @@ void Serializer::writeASTBlockEntity(const DeclContext *DC) {
25522552
}
25532553

25542554
void Serializer::writeLifetimeDependenceInfo(
2555-
LifetimeDependenceInfo lifetimeDependenceInfo, bool skipImplicit) {
2556-
if (skipImplicit && !lifetimeDependenceInfo.isExplicitlySpecified()) {
2557-
return;
2558-
}
2555+
LifetimeDependenceInfo lifetimeDependenceInfo) {
25592556
using namespace decls_block;
25602557
SmallVector<bool> paramIndices;
25612558
lifetimeDependenceInfo.getConcatenatedData(paramIndices);
@@ -4569,8 +4566,7 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
45694566
if (fnType) {
45704567
if (auto *lifetimeDependenceInfo =
45714568
fnType->getLifetimeDependenceInfoOrNull()) {
4572-
S.writeLifetimeDependenceInfo(*lifetimeDependenceInfo,
4573-
/*skipImplicit*/ true);
4569+
S.writeLifetimeDependenceInfo(*lifetimeDependenceInfo);
45744570
}
45754571
}
45764572

@@ -4697,8 +4693,7 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
46974693
if (fnType) {
46984694
if (auto *lifetimeDependenceInfo =
46994695
fnType->getLifetimeDependenceInfoOrNull()) {
4700-
S.writeLifetimeDependenceInfo(*lifetimeDependenceInfo,
4701-
/*skipImplicit*/ true);
4696+
S.writeLifetimeDependenceInfo(*lifetimeDependenceInfo);
47024697
}
47034698
}
47044699

@@ -4868,8 +4863,7 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
48684863
if (fnType) {
48694864
if (auto *lifetimeDependenceInfo =
48704865
fnType->getLifetimeDependenceInfoOrNull()) {
4871-
S.writeLifetimeDependenceInfo(*lifetimeDependenceInfo,
4872-
/*skipImplicit*/ true);
4866+
S.writeLifetimeDependenceInfo(*lifetimeDependenceInfo);
48734867
}
48744868
}
48754869

lib/Serialization/Serialization.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,7 @@ class Serializer : public SerializerBase {
387387

388388
/// Writes lifetime dependence info
389389
void
390-
writeLifetimeDependenceInfo(LifetimeDependenceInfo lifetimeDependenceInfo,
391-
bool skipImplicit = false);
390+
writeLifetimeDependenceInfo(LifetimeDependenceInfo lifetimeDependenceInfo);
392391

393392
/// Registers the abbreviation for the given decl or type layout.
394393
template <typename Layout>

0 commit comments

Comments
 (0)