Skip to content

Commit 88ad6d5

Browse files
authored
Merge pull request #17569 from adrian-prantl/inlined-at
2 parents 4a29944 + 7680ac0 commit 88ad6d5

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

lib/SIL/SILDebugScope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
using namespace swift;
2424

2525
SILDebugScope::SILDebugScope(SILLocation Loc, SILFunction *SILFn,
26-
const SILDebugScope *ParentScope ,
26+
const SILDebugScope *ParentScope,
2727
const SILDebugScope *InlinedCallSite)
2828
: Loc(Loc), InlinedCallSite(InlinedCallSite) {
2929
if (ParentScope)

lib/SILOptimizer/Utils/SILInliner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,10 @@ SILInliner::getOrCreateInlineScope(const SILDebugScope *CalleeScope) {
435435
auto &M = getBuilder().getFunction().getModule();
436436
auto InlinedAt =
437437
getOrCreateInlineScope(CalleeScope->InlinedCallSite);
438+
auto ParentScope = CalleeScope->Parent.dyn_cast<const SILDebugScope *>();
438439
auto *InlinedScope = new (M) SILDebugScope(
439440
CalleeScope->Loc, CalleeScope->Parent.dyn_cast<SILFunction *>(),
440-
CalleeScope->Parent.dyn_cast<const SILDebugScope *>(), InlinedAt);
441+
ParentScope ? getOrCreateInlineScope(ParentScope) : nullptr, InlinedAt);
441442
InlinedScopeCache.insert({CalleeScope, InlinedScope});
442443
return InlinedScope;
443444
}

test/DebugInfo/inlined-generics-basic.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ func yes() -> Bool { return true }
2424
// SIL: sil_scope [[F1G:.*]] { loc "f.swift":5:5 parent [[F1]] }
2525
// SIL: sil_scope [[F1G1:.*]] { loc "g.swift":2:3 {{.*}}inlined_at [[F1G]] }
2626
// SIL: sil_scope [[F1G3:.*]] { loc "g.swift":3:5 {{.*}}inlined_at [[F1G]] }
27-
// SIL: sil_scope [[F1G3H2:.*]] { loc "h.swift":3:3{{.*}} inlined_at 12 }
27+
// SIL: sil_scope [[F1G3H:.*]] { loc "h.swift":1:24
28+
// SIL-SAME: parent @{{.*}}1h{{.*}} inlined_at [[F1G3]] }
29+
// SIL: sil_scope [[F1G3H1:.*]] { loc "h.swift":1:37
30+
// SIL-SAME: parent [[F1G3H]] inlined_at [[F1G3]] }
31+
// SIL: sil_scope [[F1G3H2:.*]] { loc "h.swift":3:3
32+
// SIL-SAME: parent [[F1G3H1]] inlined_at [[F1G3]] }
2833
// SIL: sil_scope [[F1G3H2_THUNK:.*]] { loc "use.swift":1:21
2934
// SIL-SAME: inlined_at [[F1G3H2]] }
3035

0 commit comments

Comments
 (0)