Skip to content

Commit 3141dfa

Browse files
committed
LifetimeDependence: Don't create empty IndexSubsets
1 parent 180fccf commit 3141dfa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/Sema/LifetimeDependence.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,15 @@ LifetimeDependenceInfo::fromTypeRepr(AbstractFunctionDecl *afd, Type resultType,
232232
}
233233

234234
return LifetimeDependenceInfo(
235-
IndexSubset::get(ctx, inheritLifetimeParamIndices),
236-
IndexSubset::get(ctx, borrowLifetimeParamIndices),
237-
IndexSubset::get(ctx, mutateLifetimeParamIndices));
235+
inheritLifetimeParamIndices.any()
236+
? IndexSubset::get(ctx, inheritLifetimeParamIndices)
237+
: nullptr,
238+
borrowLifetimeParamIndices.any()
239+
? IndexSubset::get(ctx, borrowLifetimeParamIndices)
240+
: nullptr,
241+
mutateLifetimeParamIndices.any()
242+
? IndexSubset::get(ctx, mutateLifetimeParamIndices)
243+
: nullptr);
238244
}
239245

240246
llvm::Optional<LifetimeDependenceInfo>

0 commit comments

Comments
 (0)