mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Previously type sizes would be inconsistently sourced from either the LLVM type or the FixedTypeInfo, depending on the call site. This was problematic because TypeInfo operates with a resolution of whole bytes, which means that types such as i1 would get a reported as having a size of 8. This patch now asserts that all occurrences of the same type have the same size as the first, cached occurence. To avoid triggering the cached type verification assertion, this patch avoids caching of storage-sized containers. It also removes the unique identifier from forward declarations, which could lead to type confusion during LTO. rdar://102367872
26 lines
1.2 KiB
Swift
26 lines
1.2 KiB
Swift
// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
|
|
|
|
struct __CurrentErrno {}
|
|
struct CErrorOr<T>
|
|
{
|
|
var value : T?
|
|
init(x : __CurrentErrno) {
|
|
// CHECK: define hidden {{.*}}void @"$s20generic_enum_closure8CErrorOrV1xACyxGAA14__CurrentErrnoV_tcfC"
|
|
// CHECK-NOT: define
|
|
// This is a SIL-level debug_value_addr instruction.
|
|
// CHECK: call void @llvm.dbg.declare
|
|
// Self is in a dynamic alloca, hence the shadow copy.
|
|
// CHECK: call void @llvm.dbg.declare(
|
|
// CHECK-SAME: metadata i8** %[[SHADOW:.*]], metadata ![[SELF:.*]], meta
|
|
// CHECK-SAME: !DIExpression(DW_OP_deref))
|
|
// CHECK-DAG: store i8* %[[DYN:.*]], i8** %[[SHADOW]]
|
|
// CHECK-DAG: %[[DYN]] = alloca i8, i{{32|64}} %
|
|
// CHECK-DAG: ![[SELF]] = !DILocalVariable(name: "self", scope:{{.*}}, type: ![[TY_CONTAINER:.*]])
|
|
// CHECK-DAG: ![[TY_CONTAINER]] = !DICompositeType({{.*}}elements: ![[TY_ELTS:[0-9]+]]
|
|
// CHECK-DAG: ![[TY_ELTS]] = !{![[TY_MEMBER:[0-9]+]]}
|
|
// CHECK-DAG: ![[TY_MEMBER]] = !DIDerivedType(tag: DW_TAG_member, {{.*}}baseType: ![[TY:[0-9]+]]
|
|
// CHECK-DAG: ![[TY]] = !DICompositeType({{.*}}, name: "$s20generic_enum_closure8CErrorOrVyxGD"
|
|
value = .none
|
|
}
|
|
}
|