mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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
18 lines
790 B
Swift
18 lines
790 B
Swift
// RUN: %empty-directory(%t)
|
|
//
|
|
// Compile the external swift module.
|
|
// RUN: %target-swift-frontend -g -emit-module -enable-library-evolution \
|
|
// RUN: -emit-module-path=%t/resilient_protocol.swiftmodule \
|
|
// RUN: -module-name=resilient_protocol %S/../Inputs/resilient_protocol.swift
|
|
//
|
|
// RUN: %target-swift-frontend -g -I %t -emit-ir %s -o - | %FileCheck %s
|
|
import resilient_protocol
|
|
|
|
public struct S<T> : OtherResilientProtocol {
|
|
public var v : T
|
|
public func requirement() -> Int { return 42 }
|
|
}
|
|
|
|
// Test that this type has no size (instead of an incorrect size of 0).
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "$s13ResilientSize1SVyxGD", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, flags: DIFlagFwdDecl, runtimeLang: DW_LANG_Swift, templateParams: !{{[0-9]+}})
|