mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use the generic type lowering algorithm described in "docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion type to the type expected by the ABI. Change IRGen to use the swift calling convention (swiftcc) for native swift functions. Use the 'swiftself' attribute on self parameters and for closures contexts. Use the 'swifterror' parameter for swift error parameters. Change functions in the runtime that are called as native swift functions to use the swift calling convention. rdar://19978563
23 lines
870 B
Swift
23 lines
870 B
Swift
// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests -primary-file %s -emit-ir -g -o - | %FileCheck %s
|
|
|
|
struct __CurrentErrno {}
|
|
struct CErrorOr<T>
|
|
{
|
|
var value : T?
|
|
init(x : __CurrentErrno) {
|
|
// CHECK: define hidden {{.*}}void @_T020generic_enum_closure8CErrorOrVACyxGAA14__CurrentErrnoV1x_tcfC
|
|
// CHECK-NOT: define
|
|
// This is a SIL-level debug_value_addr instruction.
|
|
// CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[SELF:.*]], metadata !{{[0-9]+}})
|
|
// CHECK: ![[SELF]] = !DILocalVariable(name: "self", scope
|
|
// CHECK-SAME: type: ![[T1:.*]])
|
|
// CHECK: ![[T1]] = !DICompositeType(
|
|
// CHECK-SAME: identifier: "_T020generic_enum_closure8CErrorOrVyACQq_GD"
|
|
value = .none
|
|
}
|
|
func isError() -> Bool {
|
|
assert(value != nil, "the object should not contain an error")
|
|
return false
|
|
}
|
|
}
|