From 88d8d9fabe885de11532e3b2df79e9be85e0cfbe Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 13 May 2020 23:36:15 -0400 Subject: [PATCH 1/2] AST: Don't set source location on cloned parameter lists --- lib/AST/Decl.cpp | 4 ++-- test/SILGen/Inputs/partial_apply_debuginfo_other.swift | 3 +++ test/SILGen/partial_apply_debuginfo.swift | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 test/SILGen/Inputs/partial_apply_debuginfo_other.swift create mode 100644 test/SILGen/partial_apply_debuginfo.swift diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 13a4d46dcac9e..29d993b205027 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -6106,8 +6106,8 @@ ParamDecl::ParamDecl(SourceLoc specifierLoc, ParamDecl *ParamDecl::cloneWithoutType(const ASTContext &Ctx, ParamDecl *PD) { auto *Clone = new (Ctx) ParamDecl( - PD->getSpecifierLoc(), PD->getArgumentNameLoc(), PD->getArgumentName(), - PD->getArgumentNameLoc(), PD->getParameterName(), PD->getDeclContext()); + SourceLoc(), SourceLoc(), PD->getArgumentName(), + SourceLoc(), PD->getParameterName(), PD->getDeclContext()); Clone->DefaultValueAndFlags.setPointerAndInt( nullptr, PD->DefaultValueAndFlags.getInt()); Clone->Bits.ParamDecl.defaultArgumentKind = diff --git a/test/SILGen/Inputs/partial_apply_debuginfo_other.swift b/test/SILGen/Inputs/partial_apply_debuginfo_other.swift new file mode 100644 index 0000000000000..0321b923540eb --- /dev/null +++ b/test/SILGen/Inputs/partial_apply_debuginfo_other.swift @@ -0,0 +1,3 @@ +public class Horse { + func buck(rider: Any) {} +} diff --git a/test/SILGen/partial_apply_debuginfo.swift b/test/SILGen/partial_apply_debuginfo.swift new file mode 100644 index 0000000000000..ce1183fc40604 --- /dev/null +++ b/test/SILGen/partial_apply_debuginfo.swift @@ -0,0 +1,7 @@ +// RUN: %target-swift-frontend -emit-silgen %S/Inputs/partial_apply_debuginfo_other.swift -primary-file %s -module-name partial_apply_debuginfo -g -Xllvm -sil-print-debuginfo | %FileCheck %s + +func doIt() { + _ = Horse.buck +} + +// CHECK-NOT: partial_apply_debuginfo_other.swift From ffd92f97d2eceefcb6584c5b1184f01c6a10cd0e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 26 May 2020 18:06:14 -0400 Subject: [PATCH 2/2] Add test case for --- test/DebugInfo/Inputs/curry_thunk_other.swift | 7 +++++++ test/DebugInfo/curry_thunk.swift | 8 ++++++++ test/SILGen/Inputs/partial_apply_debuginfo_other.swift | 3 --- test/SILGen/partial_apply_debuginfo.swift | 7 ------- 4 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 test/DebugInfo/Inputs/curry_thunk_other.swift create mode 100644 test/DebugInfo/curry_thunk.swift delete mode 100644 test/SILGen/Inputs/partial_apply_debuginfo_other.swift delete mode 100644 test/SILGen/partial_apply_debuginfo.swift diff --git a/test/DebugInfo/Inputs/curry_thunk_other.swift b/test/DebugInfo/Inputs/curry_thunk_other.swift new file mode 100644 index 0000000000000..914596bdfbc75 --- /dev/null +++ b/test/DebugInfo/Inputs/curry_thunk_other.swift @@ -0,0 +1,7 @@ +public struct HTTPMethod { + public let rawValue: String + + public init(rawValue: String) { + self.rawValue = rawValue + } +} diff --git a/test/DebugInfo/curry_thunk.swift b/test/DebugInfo/curry_thunk.swift new file mode 100644 index 0000000000000..3197a6a78ac17 --- /dev/null +++ b/test/DebugInfo/curry_thunk.swift @@ -0,0 +1,8 @@ +// RUN: %target-swift-frontend -primary-file %s %S/Inputs/curry_thunk_other.swift -emit-ir -g -o - | %FileCheck %s + +public func testCurryThunk() -> [HTTPMethod] { + return ["asdf"].map(HTTPMethod.init) +} + +// CHECK: [[FILE:![0-9]+]] = !DIFile(filename: "{{.*}}/curry_thunk.swift", directory: "{{.*}}") +// CHECK: {{![0-9]+}} = !DILocalVariable(name: "rawValue", arg: 1, scope: {{![0-9]+}}, file: {{![0-9]+}}, type: {{![0-9]+}}, flags: DIFlagArtificial) diff --git a/test/SILGen/Inputs/partial_apply_debuginfo_other.swift b/test/SILGen/Inputs/partial_apply_debuginfo_other.swift deleted file mode 100644 index 0321b923540eb..0000000000000 --- a/test/SILGen/Inputs/partial_apply_debuginfo_other.swift +++ /dev/null @@ -1,3 +0,0 @@ -public class Horse { - func buck(rider: Any) {} -} diff --git a/test/SILGen/partial_apply_debuginfo.swift b/test/SILGen/partial_apply_debuginfo.swift deleted file mode 100644 index ce1183fc40604..0000000000000 --- a/test/SILGen/partial_apply_debuginfo.swift +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: %target-swift-frontend -emit-silgen %S/Inputs/partial_apply_debuginfo_other.swift -primary-file %s -module-name partial_apply_debuginfo -g -Xllvm -sil-print-debuginfo | %FileCheck %s - -func doIt() { - _ = Horse.buck -} - -// CHECK-NOT: partial_apply_debuginfo_other.swift