Skip to content

Commit 9656f26

Browse files
committed
[SIL] Add getProperty to AssignOrInit instruction
This aim to compensate the fact that not all of the changes were cherry-picked to 5.9.
1 parent ae86c61 commit 9656f26

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/SIL/SILInstruction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4962,6 +4962,8 @@ class AssignOrInitInst
49624962
SILValue getInitializer() const { return Operands[2].get(); }
49634963
SILValue getSetter() { return Operands[3].get(); }
49644964

4965+
VarDecl *getProperty() const;
4966+
49654967
Mode getMode() const {
49664968
return Mode(sharedUInt8().AssignOrInitInst.mode);
49674969
}

lib/SIL/IR/SILInstructions.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,12 @@ bool AssignOrInitInst::isPropertyAlreadyInitialized(unsigned propertyIdx) {
12831283
return Assignments.test(propertyIdx);
12841284
}
12851285

1286+
VarDecl *AssignOrInitInst::getProperty() const {
1287+
auto *accessor = getReferencedInitAccessor();
1288+
assert(accessor);
1289+
return cast<VarDecl>(accessor->getStorage());
1290+
}
1291+
12861292
StringRef AssignOrInitInst::getPropertyName() const {
12871293
auto *accessor = getReferencedInitAccessor();
12881294
assert(accessor);

0 commit comments

Comments
 (0)