Skip to content

Commit c036ea0

Browse files
authored
Merge pull request swiftlang#28534 from gottesmm/pr-454c8cb401a20abf72d32b98e7e0bed46651e055
2 parents dc258b2 + e4680a3 commit c036ea0

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

include/swift/SIL/SILInstruction.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,11 @@ class AllocationInst : public SingleValueInstruction {
13971397

13981398
public:
13991399
DEFINE_ABSTRACT_SINGLE_VALUE_INST_BOILERPLATE(AllocationInst)
1400+
1401+
/// Return the underlying variable declaration associated with this
1402+
/// allocation, or null if this allocation inst is associated with a temporary
1403+
/// allocation.
1404+
VarDecl *getDecl() const;
14001405
};
14011406

14021407
class DeallocStackInst;
@@ -1439,10 +1444,6 @@ class AllocStackInst final
14391444
void setDynamicLifetime() { dynamicLifetime = true; }
14401445
bool hasDynamicLifetime() const { return dynamicLifetime; }
14411446

1442-
/// Return the underlying variable declaration associated with this
1443-
/// allocation, or null if this is a temporary allocation.
1444-
VarDecl *getDecl() const;
1445-
14461447
/// Return the debug variable information attached to this instruction.
14471448
Optional<SILDebugVariable> getVarInfo() const {
14481449
auto RawValue = SILInstruction::Bits.AllocStackInst.VarInfo;
@@ -1685,10 +1686,6 @@ class AllocBoxInst final
16851686
// Return the type of the memory stored in the alloc_box.
16861687
SILType getAddressType() const;
16871688

1688-
/// Return the underlying variable declaration associated with this
1689-
/// allocation, or null if this is a temporary allocation.
1690-
VarDecl *getDecl() const;
1691-
16921689
/// Return the debug variable information attached to this instruction.
16931690
Optional<SILDebugVariable> getVarInfo() const {
16941691
return VarInfo.get(getDecl(), getTrailingObjects<char>());

lib/SIL/SILInstructions.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ AllocStackInst::create(SILDebugLocation Loc,
180180
hasDynamicLifetime);
181181
}
182182

183-
VarDecl *AllocStackInst::getDecl() const {
183+
VarDecl *AllocationInst::getDecl() const {
184184
return getLoc().getAsASTNode<VarDecl>();
185185
}
186186

@@ -290,10 +290,6 @@ SILType AllocBoxInst::getAddressType() const {
290290
.getAddressType();
291291
}
292292

293-
VarDecl *AllocBoxInst::getDecl() const {
294-
return getLoc().getAsASTNode<VarDecl>();
295-
}
296-
297293
DebugValueInst::DebugValueInst(SILDebugLocation DebugLoc, SILValue Operand,
298294
SILDebugVariable Var)
299295
: UnaryInstructionBase(DebugLoc, Operand),

0 commit comments

Comments
 (0)