Skip to content

Commit 3c411cb

Browse files
committed
[mem-access-utils] Teach memInstMustInitialize that indirect out parameters are initializing.
Just something I noticed while reading the code.
1 parent f443f22 commit 3c411cb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/SIL/Utils/MemAccessUtils.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,7 @@ static bool isScratchBuffer(SILValue value) {
18931893

18941894
bool swift::memInstMustInitialize(Operand *memOper) {
18951895
SILValue address = memOper->get();
1896+
18961897
SILInstruction *memInst = memOper->getUser();
18971898

18981899
switch (memInst->getKind()) {
@@ -1908,6 +1909,12 @@ bool swift::memInstMustInitialize(Operand *memOper) {
19081909
case SILInstructionKind::InjectEnumAddrInst:
19091910
return true;
19101911

1912+
case SILInstructionKind::BeginApplyInst:
1913+
case SILInstructionKind::TryApplyInst:
1914+
case SILInstructionKind::ApplyInst: {
1915+
FullApplySite applySite(memInst);
1916+
return applySite.isIndirectResultOperand(*memOper);
1917+
}
19111918
case SILInstructionKind::StoreInst:
19121919
return cast<StoreInst>(memInst)->getOwnershipQualifier()
19131920
== StoreOwnershipQualifier::Init;

0 commit comments

Comments
 (0)