Skip to content

Commit 48a3b74

Browse files
Merge pull request #73996 from Snowy1803/6.0-rdar126556557
[6.0] [DebugInfo] [SILGen] Remove all invalid debug info from intermediates
2 parents e90272b + 4809c1e commit 48a3b74

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

lib/SILGen/SILGenProlog.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,18 +1549,19 @@ uint16_t SILGenFunction::emitBasicProlog(
15491549
B.createDebugValue(loc, undef.getValue(), dbgVar);
15501550
}
15511551

1552-
for (auto &i : *B.getInsertionBB()) {
1553-
auto *alloc = dyn_cast<AllocStackInst>(&i);
1554-
if (!alloc)
1555-
continue;
1556-
auto varInfo = alloc->getVarInfo();
1557-
if (!varInfo || varInfo->ArgNo)
1558-
continue;
1559-
// The allocation has a varinfo but no argument number, which should not
1560-
// happen in the prolog. Unfortunately, some copies can generate wrong
1561-
// debug info, so we have to fix it here, by invalidating it.
1562-
alloc->invalidateVarInfo();
1563-
}
1552+
for (auto &bb : B.getFunction())
1553+
for (auto &i : bb) {
1554+
auto *alloc = dyn_cast<AllocStackInst>(&i);
1555+
if (!alloc)
1556+
continue;
1557+
auto varInfo = alloc->getVarInfo();
1558+
if (!varInfo || varInfo->ArgNo)
1559+
continue;
1560+
// The allocation has a varinfo but no argument number, which should not
1561+
// happen in the prolog. Unfortunately, some copies can generate wrong
1562+
// debug info, so we have to fix it here, by invalidating it.
1563+
alloc->invalidateVarInfo();
1564+
}
15641565

15651566
return ArgNo;
15661567
}

test/DebugInfo/parameter-pack.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
2+
3+
// https://github.com/apple/swift/issues/73030
4+
5+
// CHECK-LABEL: sil {{.+}} @$s4main1f1t1cxxQp_q_t_q0_txxQp_t_q_t_q0_tRvzr1_lF
6+
func f<each A, B, C>(t: ((repeat each A), B), c: C) -> ((repeat each A, B), C) {
7+
// CHECK-NOT: let, name "t"
8+
// CHECK: alloc_stack [lexical] [var_decl] $((repeat each A), B), let, name "t", argno 1
9+
// CHECK: debug_value %{{[0-9]+}} : $*C, let, name "c", argno 2, expr op_deref
10+
((repeat each t.0, t.1), c)
11+
}

0 commit comments

Comments
 (0)