Skip to content

Commit 24a793c

Browse files
authored
Merge pull request #14146 from bob-wilson/rdar36765742
Don't drop function argument debug info in the LoadableByAddress tran…
2 parents 629940c + e76adf0 commit 24a793c

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ struct StructLoweringState {
375375
SmallVector<SILInstruction *, 16> destroyValueInstsToMod;
376376
// All debug instructions.
377377
// to be modified *only if* the operands are used in "real" instructions
378-
SmallVector<SILInstruction *, 16> debugInstsToMod;
378+
SmallVector<DebugValueInst *, 16> debugInstsToMod;
379379

380380
StructLoweringState(SILFunction *F, irgen::IRGenModule &Mod)
381381
: F(F), Mod(Mod) {}
@@ -1780,7 +1780,7 @@ static void rewriteFunction(StructLoweringState &pass,
17801780
instr->getParent()->erase(instr);
17811781
}
17821782

1783-
for (SILInstruction *instr : pass.debugInstsToMod) {
1783+
for (DebugValueInst *instr : pass.debugInstsToMod) {
17841784
assert(instr->getAllOperands().size() == 1 &&
17851785
"Debug instructions have one operand");
17861786
for (Operand &operand : instr->getAllOperands()) {
@@ -1795,7 +1795,8 @@ static void rewriteFunction(StructLoweringState &pass,
17951795
assert(currOperand->getType().isAddress() &&
17961796
"Expected an address type");
17971797
SILBuilderWithScope debugBuilder(instr);
1798-
debugBuilder.createDebugValueAddr(instr->getLoc(), currOperand);
1798+
debugBuilder.createDebugValueAddr(instr->getLoc(), currOperand,
1799+
instr->getVarInfo());
17991800
instr->getParent()->erase(instr);
18001801
}
18011802
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
2+
3+
public struct Large {
4+
let field1 : Int64 = 1
5+
let field2 : Int64 = 2
6+
let field3 : Int64 = 3
7+
let field4 : Int64 = 4
8+
let field5 : Int64 = 5
9+
let field6 : Int64 = 6
10+
let field7 : Int64 = 7
11+
let field8 : Int64 = 8
12+
}
13+
14+
// CHECK: !DILocalVariable(name: "largeArg", arg: 1
15+
public func f(_ largeArg : Large) {}

0 commit comments

Comments
 (0)