Skip to content

Commit fafdc51

Browse files
committed
Use compiler-generated location for func.-sig.-spec. thunks
Function signature specialization thunks don't have any correspondence to code the user wrote. rdar://problem/28859432
1 parent 2a57027 commit fafdc51

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

lib/SILOptimizer/FunctionSignatureTransforms/FunctionSignatureOpts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ void FunctionSignatureTransform::createFunctionSignatureOptimizedFunction() {
547547
ThunkBody->createFunctionArgument(ArgDesc.Arg->getType(), ArgDesc.Decl);
548548
}
549549

550-
SILLocation Loc = ThunkBody->getParent()->getLocation();
550+
SILLocation Loc = RegularLocation::getAutoGeneratedLocation();
551551
SILBuilder Builder(ThunkBody);
552552
Builder.setCurrentDebugScope(ThunkBody->getParent()->getDebugScope());
553553

test/DebugInfo/inlined-generics-basic.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,30 @@
33
@inline(never)
44
func yes() -> Bool { return true }
55

6-
@inline(never)
7-
func use<V>(_ v: V) {}
6+
#sourceLocation(file: "use.swift", line: 1)
7+
@inline(never) func use<V>(_ v: V) {}
88

9-
@inline(__always)
10-
func h<U>(_ u: U) {
9+
#sourceLocation(file: "h.swift", line: 1)
10+
@inline(__always) func h<U>(_ u: U) {
1111
yes()
1212
use(u)
1313
}
1414

1515
#sourceLocation(file: "g.swift", line: 1)
1616
@inline(__always) func g<T>(_ t: T) {
1717
if (yes()) {
18-
use(t)
18+
h(t)
1919
}
2020
}
2121

2222
// SIL: sil_scope [[F:.*]] { {{.*}}parent @$S1A1CC1fyyqd__lF
23-
// SIL: sil_scope [[F0:.*]] { loc "f.swift":1:29 parent [[F]] }
24-
// SIL: sil_scope [[F_G_S:.*]] { loc "f.swift":5:5 parent [[F0]] }
25-
// SIL: sil_scope [[G_S:.*]] { loc "g.swift":2:3 {{.*}} inlined_at [[F_G_S]] }
23+
// SIL: sil_scope [[F1:.*]] { loc "f.swift":1:29 parent [[F]] }
24+
// SIL: sil_scope [[F1G:.*]] { loc "f.swift":5:5 parent [[F1]] }
25+
// SIL: sil_scope [[F1G1:.*]] { loc "g.swift":2:3 {{.*}}inlined_at [[F1G]] }
26+
// 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 }
28+
// SIL: sil_scope [[F1G3H2_THUNK:.*]] { loc "use.swift":1:21
29+
// SIL-SAME: inlined_at [[F1G3H2]] }
2630

2731
#sourceLocation(file: "C.swift", line: 1)
2832
public class C<R> {
@@ -32,9 +36,9 @@ public class C<R> {
3236
// SIL: // C.f<A>(_:)
3337
#sourceLocation(file: "f.swift", line: 1)
3438
public func f<S> (_ s: S) {
35-
// SIL: debug_value_addr %0 : $*S, let, name "s", argno 1,
36-
// SIL-SAME: scope [[F]]
37-
// SIL: function_ref {{.*}}yes{{.*}} scope [[G_S]]
39+
// SIL: debug_value_addr %0 : $*S, let, name "s", argno 1,{{.*}} scope [[F]]
40+
// SIL: function_ref {{.*}}yes{{.*}} scope [[F1G1]]
41+
// SIL: function_ref {{.*}}use{{.*}}:0:0, scope [[F1G3H2_THUNK]]
3842
g(s)
3943
g(r)
4044
g((s, s))

0 commit comments

Comments
 (0)