Skip to content

Commit bbc1d8f

Browse files
authored
Merge pull request #64831 from nate-chandler/comment/20230331/1
[NFC] SILGen: Added comment.
2 parents eb8e984 + 1126561 commit bbc1d8f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILGen/SILGenDecl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ class LocalVariableInitialization : public SingleBufferInitialization {
528528
if (SGF.getASTContext().SILOpts.supportsLexicalLifetimes(SGF.getModule())) {
529529
auto loweredType = SGF.getTypeLowering(decl->getType()).getLoweredType();
530530
auto lifetime = SGF.F.getLifetime(decl, loweredType);
531+
// The box itself isn't lexical--neither a weak reference nor an unsafe
532+
// pointer to a box can be formed; and the box doesn't synchronize on
533+
// deinit.
534+
//
535+
// Only add a lexical lifetime to the box if the the variable it stores
536+
// requires one.
531537
if (lifetime.isLexical()) {
532538
Box = SGF.B.createBeginBorrow(decl, Box, /*isLexical=*/true);
533539
}

0 commit comments

Comments
 (0)