mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Allow mangling LocatableType in DWARF mode
Fixes rdar://problem/145954323.
This commit is contained in:
@@ -1379,8 +1379,12 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
|
||||
case TypeKind::BuiltinUnsafeValueBuffer:
|
||||
return appendOperator("BB");
|
||||
case TypeKind::BuiltinUnboundGeneric:
|
||||
case TypeKind::Locatable:
|
||||
llvm_unreachable("not a real type");
|
||||
llvm::errs() << "Don't know how to mangle a BuiltinUnboundGenericType\n";
|
||||
abort();
|
||||
case TypeKind::Locatable: {
|
||||
auto loc = cast<LocatableType>(tybase);
|
||||
return appendType(loc->getSinglyDesugaredType(), sig, forDecl);
|
||||
}
|
||||
case TypeKind::BuiltinFixedArray: {
|
||||
auto bfa = cast<BuiltinFixedArrayType>(tybase);
|
||||
appendType(bfa->getSize(), sig, forDecl);
|
||||
|
||||
13
test/DebugInfo/Inputs/result_builder.swift
Normal file
13
test/DebugInfo/Inputs/result_builder.swift
Normal file
@@ -0,0 +1,13 @@
|
||||
@resultBuilder
|
||||
public struct Builder {
|
||||
@_alwaysEmitIntoClient
|
||||
public static func buildExpression<X>(_ x: X) -> X {x}
|
||||
@_alwaysEmitIntoClient
|
||||
public static func buildBlock<X>(_ x: X) -> X {x}
|
||||
}
|
||||
|
||||
public struct View<X> {
|
||||
public init(@Builder _: () -> X) {}
|
||||
|
||||
public func closure(_: () -> Void) {}
|
||||
}
|
||||
19
test/DebugInfo/locatable_type.swift
Normal file
19
test/DebugInfo/locatable_type.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend %S/Inputs/result_builder.swift -emit-module -emit-module-path %t/result_builder.swiftmodule
|
||||
// RUN: %target-swift-frontend -emit-ir %s -I %t -g -O
|
||||
|
||||
// FIXME: Devise a test case that does not involve -O.
|
||||
|
||||
import result_builder
|
||||
|
||||
struct S {
|
||||
static func foo(_ s: S?) -> S? {s}
|
||||
static func foo(_ s: S) -> S {s}
|
||||
}
|
||||
|
||||
public func test() {
|
||||
View { View { S() } }
|
||||
.closure {
|
||||
let _: S? = .foo(S())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user