Skip to content

Commit 71b2c50

Browse files
authored
Merge pull request #31778 from slavapestov/cloned-parameter-list-source-loc
AST: Don't set source location on cloned parameter lists
2 parents 2419112 + ffd92f9 commit 71b2c50

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

lib/AST/Decl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6115,8 +6115,8 @@ ParamDecl::ParamDecl(SourceLoc specifierLoc,
61156115

61166116
ParamDecl *ParamDecl::cloneWithoutType(const ASTContext &Ctx, ParamDecl *PD) {
61176117
auto *Clone = new (Ctx) ParamDecl(
6118-
PD->getSpecifierLoc(), PD->getArgumentNameLoc(), PD->getArgumentName(),
6119-
PD->getArgumentNameLoc(), PD->getParameterName(), PD->getDeclContext());
6118+
SourceLoc(), SourceLoc(), PD->getArgumentName(),
6119+
SourceLoc(), PD->getParameterName(), PD->getDeclContext());
61206120
Clone->DefaultValueAndFlags.setPointerAndInt(
61216121
nullptr, PD->DefaultValueAndFlags.getInt());
61226122
Clone->Bits.ParamDecl.defaultArgumentKind =
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public struct HTTPMethod {
2+
public let rawValue: String
3+
4+
public init(rawValue: String) {
5+
self.rawValue = rawValue
6+
}
7+
}

test/DebugInfo/curry_thunk.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-frontend -primary-file %s %S/Inputs/curry_thunk_other.swift -emit-ir -g -o - | %FileCheck %s
2+
3+
public func testCurryThunk() -> [HTTPMethod] {
4+
return ["asdf"].map(HTTPMethod.init)
5+
}
6+
7+
// CHECK: [[FILE:![0-9]+]] = !DIFile(filename: "{{.*}}/curry_thunk.swift", directory: "{{.*}}")
8+
// CHECK: {{![0-9]+}} = !DILocalVariable(name: "rawValue", arg: 1, scope: {{![0-9]+}}, file: {{![0-9]+}}, type: {{![0-9]+}}, flags: DIFlagArtificial)

0 commit comments

Comments
 (0)