Skip to content

Commit 23cbd7f

Browse files
committed
SILGen: Fix source location for the enum payload argument source
We should use the source location of the call site, and not the enum element declaration, otherwise we emit incorrect debug info. Fixes <rdar://problem/63067437>.
1 parent 96b774f commit 23cbd7f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3818,7 +3818,7 @@ RValue CallEmission::applyEnumElementConstructor(SGFContext C) {
38183818
resultFnType.getParams(),
38193819
/*canonicalVararg*/ true);
38203820
auto arg = RValue(SGF, argVals, payloadTy->getCanonicalType());
3821-
payload = ArgumentSource(element, std::move(arg));
3821+
payload = ArgumentSource(uncurriedLoc, std::move(arg));
38223822
formalResultType = cast<FunctionType>(formalResultType).getResult();
38233823
origFormalType = origFormalType.getFunctionResultType();
38243824
} else {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public enum MyEnum {
2+
case hasPayload(argument: Any)
3+
}

test/SILGen/enum_debuginfo.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %target-swift-frontend -emit-silgen %S/Inputs/enum_debuginfo_other.swift -primary-file %s -module-name enum_debuginfo -g -Xllvm -sil-print-debuginfo | %FileCheck %s
2+
3+
public func makeEnum() -> MyEnum {
4+
return .hasPayload(argument: 123)
5+
}
6+
7+
// CHECK-NOT: enum_debuginfo_other.swift

0 commit comments

Comments
 (0)