Skip to content

Commit 36f65b3

Browse files
committed
[SIL] InitAccessors: Adjust SIL printer/parser to support "field" of assign_or_init instruction
1 parent ddad2a7 commit 36f65b3

File tree

3 files changed

+34
-26
lines changed

3 files changed

+34
-26
lines changed

lib/SIL/IR/SILPrinter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,11 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
18061806
}
18071807
}
18081808

1809-
*this << "self " << getIDAndType(AI->getSelf());
1809+
*this << "#";
1810+
printFullContext(AI->getProperty()->getDeclContext(), PrintState.OS);
1811+
*this << AI->getPropertyName();
1812+
1813+
*this << ", self " << getIDAndType(AI->getSelf());
18101814
*this << ", value " << getIDAndType(AI->getSrc());
18111815
*this << ", init " << getIDAndType(AI->getInitializer())
18121816
<< ", set " << getIDAndType(AI->getSetter());

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4745,12 +4745,15 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
47454745
}
47464746

47474747
case SILInstructionKind::AssignOrInitInst: {
4748+
ValueDecl *Prop;
47484749
SILValue Self, Src, InitFn, SetFn;
47494750
AssignOrInitInst::Mode Mode;
47504751
llvm::SmallVector<unsigned, 2> assignments;
47514752

47524753
if (parseAssignOrInitMode(Mode, *this) ||
47534754
parseAssignOrInitAssignments(assignments, *this) ||
4755+
parseSILDottedPath(Prop) ||
4756+
P.parseToken(tok::comma, diag::expected_tok_in_sil_instr, ",") ||
47544757
parseVerbatim("self") || parseTypedValueRef(Self, B) ||
47554758
P.parseToken(tok::comma, diag::expected_tok_in_sil_instr, ",") ||
47564759
parseVerbatim("value") || parseTypedValueRef(Src, B) ||
@@ -4761,7 +4764,8 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
47614764
parseSILDebugLocation(InstLoc, B))
47624765
return true;
47634766

4764-
auto *AI = B.createAssignOrInit(InstLoc, Self, Src, InitFn, SetFn, Mode);
4767+
auto *AI = B.createAssignOrInit(InstLoc, cast<VarDecl>(Prop), Self, Src,
4768+
InitFn, SetFn, Mode);
47654769

47664770
for (unsigned index : assignments)
47674771
AI->markAsInitialized(index);

0 commit comments

Comments
 (0)