Skip to content

Commit 56d2027

Browse files
committed
Add LifetimeDependence::get from param indices
1 parent bca1dd7 commit 56d2027

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/swift/AST/LifetimeDependence.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ class LifetimeDependenceInfo {
182182

183183
static llvm::Optional<LifetimeDependenceInfo>
184184
get(AbstractFunctionDecl *decl, Type resultType, bool allowIndex = false);
185+
186+
static LifetimeDependenceInfo
187+
get(ASTContext &ctx, const SmallBitVector &inheritLifetimeIndices,
188+
const SmallBitVector &scopeLifetimeIndices);
185189
};
186190

187191
} // namespace swift

lib/Sema/LifetimeDependence.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,16 @@ LifetimeDependenceInfo::get(AbstractFunctionDecl *afd, Type resultType,
330330
return LifetimeDependenceInfo::infer(afd, resultType);
331331
}
332332

333+
LifetimeDependenceInfo
334+
LifetimeDependenceInfo::get(ASTContext &ctx,
335+
const SmallBitVector &inheritLifetimeIndices,
336+
const SmallBitVector &scopeLifetimeIndices) {
337+
return LifetimeDependenceInfo{
338+
inheritLifetimeIndices.any()
339+
? IndexSubset::get(ctx, inheritLifetimeIndices)
340+
: nullptr,
341+
scopeLifetimeIndices.any() ? IndexSubset::get(ctx, scopeLifetimeIndices)
342+
: nullptr};
343+
}
344+
333345
} // namespace swift

0 commit comments

Comments
 (0)