mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Replace hardcoded special names with call into getUserfacingName()
This fixes an assertion failure when encountering previously unhandled special names. rdar://110841130
This commit is contained in:
@@ -569,14 +569,8 @@ private:
|
||||
if (FuncDecl *FD = L.getAsASTNode<FuncDecl>())
|
||||
return getName(*FD);
|
||||
|
||||
if (L.isASTNode<ConstructorDecl>())
|
||||
return "init";
|
||||
|
||||
if (L.isASTNode<DestructorDecl>())
|
||||
return "deinit";
|
||||
|
||||
if (ValueDecl *D = L.getAsASTNode<ValueDecl>())
|
||||
return D->getBaseIdentifier().str();
|
||||
return D->getBaseName().userFacingName();
|
||||
|
||||
if (auto *D = L.getAsASTNode<MacroExpansionDecl>())
|
||||
return D->getMacroName().getBaseIdentifier().str();
|
||||
|
||||
14
test/DebugInfo/subscript.swift
Normal file
14
test/DebugInfo/subscript.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
// RUN: %target-swift-frontend %s -Onone -emit-ir -g -o - -parse-as-library -module-name a | %FileCheck %s
|
||||
public protocol P {}
|
||||
public class C : P {}
|
||||
public struct S {}
|
||||
public extension S {
|
||||
subscript<T>(_ val: T, _ type : T.Type = T.self) -> T? { return nil }
|
||||
}
|
||||
|
||||
public func f() {
|
||||
S()[0]
|
||||
}
|
||||
// CHECK: !DISubprogram(name: "deinit"
|
||||
// CHECK: !DISubprogram(name: "init"
|
||||
// CHECK: !DISubprogram(name: "subscript
|
||||
Reference in New Issue
Block a user