Skip to content

Commit df95e45

Browse files
committed
Replace hardcoded special names with call into getUserfacingName()
This fixes an assertion failure when encountering previously unhandled special names. rdar://110841130 (cherry picked from commit 229ad8b)
1 parent f1bf558 commit df95e45

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
569569
if (FuncDecl *FD = L.getAsASTNode<FuncDecl>())
570570
return getName(*FD);
571571

572-
if (L.isASTNode<ConstructorDecl>())
573-
return "init";
574-
575-
if (L.isASTNode<DestructorDecl>())
576-
return "deinit";
577-
578572
if (ValueDecl *D = L.getAsASTNode<ValueDecl>())
579-
return D->getBaseIdentifier().str();
573+
return D->getBaseName().userFacingName();
580574

581575
if (auto *D = L.getAsASTNode<MacroExpansionDecl>())
582576
return D->getMacroName().getBaseIdentifier().str();

test/DebugInfo/subscript.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %target-swift-frontend %s -Onone -emit-ir -g -o - -parse-as-library -module-name a | %FileCheck %s
2+
public protocol P {}
3+
public class C : P {}
4+
public struct S {}
5+
public extension S {
6+
subscript<T>(_ val: T, _ type : T.Type = T.self) -> T? { return nil }
7+
}
8+
9+
public func f() {
10+
S()[0]
11+
}
12+
// CHECK: !DISubprogram(name: "deinit"
13+
// CHECK: !DISubprogram(name: "init"
14+
// CHECK: !DISubprogram(name: "subscript

0 commit comments

Comments
 (0)