Skip to content

Commit f30839e

Browse files
committed
Don't assign argument numbers to the debug info of self in a value constructor.
1 parent d0581ea commit f30839e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/SILGen/SILGenConstructor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,8 @@ void SILGenFunction::emitValueConstructor(ConstructorDecl *ctor) {
187187
assert(!selfTy.getClassOrBoundGenericClass()
188188
&& "can't emit a class ctor here");
189189

190-
// Self is a curried argument and thus comes last.
191-
unsigned N = ctor->getParameterList(1)->size() + 1;
192190
// Allocate the local variable for 'self'.
193-
emitLocalVariableWithCleanup(selfDecl, false, N)->finishInitialization(*this);
191+
emitLocalVariableWithCleanup(selfDecl, false)->finishInitialization(*this);
194192

195193
// Mark self as being uninitialized so that DI knows where it is and how to
196194
// check for it.

test/DebugInfo/generic_enum_closure.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ struct CErrorOr<T>
99
// CHECK-NOT: define
1010
// This is a SIL-level debug_value_addr instruction.
1111
// CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[SELF:.*]], metadata !{{[0-9]+}})
12-
// CHECK-DAG: ![[T1:.*]] = !DICompositeType({{.*}}identifier: "_TtGV20generic_enum_closure8CErrorOrQq_S0__"
13-
// CHECK-DAG: ![[SELF]] = !DILocalVariable(name: "self", arg:{{.*}} type: ![[T1]]
12+
// CHECK: ![[SELF]] = !DILocalVariable(name: "self", scope
13+
// CHECK-SAME: type: ![[T1:.*]])
14+
// CHECK: ![[T1]] = !DICompositeType(
15+
// CHECK-SAME: identifier: "_TtGV20generic_enum_closure8CErrorOrQq_S0__"
1416
value = .none
1517
}
1618
func isError() -> Bool {

test/DebugInfo/self.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ public func f() {
1616
// CHECK: define {{.*}} @_TFV4self11stuffStructCfT_S0_(
1717
// CHECK-NEXT: entry:
1818
// CHECK-NEXT: %[[ALLOCA:.*]] = alloca %V4self11stuffStruct, align {{(4|8)}}
19-
// CHECK: call void @llvm.dbg.declare(metadata %V4self11stuffStruct* %[[ALLOCA]], metadata ![[SELF:.*]], metadata !{{[0-9]+}}), !db
19+
// CHECK: call void @llvm.dbg.declare(metadata %V4self11stuffStruct* %[[ALLOCA]],
20+
// CHECK-SAME: metadata ![[SELF:.*]], metadata !{{[0-9]+}}), !dbg
2021
// CHECK: ![[STUFFSTRUCT:.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "stuffStruct",{{.*}}identifier
21-
// CHECK: ![[SELF]] = !DILocalVariable(name: "self", arg: 1,
22+
// CHECK: ![[SELF]] = !DILocalVariable(name: "self", scope
2223
// CHECK-SAME: type: ![[STUFFSTRUCT]]
2324

0 commit comments

Comments
 (0)