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
26 lines
832 B
Swift
26 lines
832 B
Swift
// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests %s -emit-ir -g -o - | %FileCheck %s
|
|
|
|
func markUsed<T>(_ t: T) {}
|
|
|
|
protocol AProtocol {
|
|
func print()
|
|
}
|
|
|
|
class AClass : AProtocol {
|
|
var x: UInt32
|
|
init() { x = 0xDEADBEEF }
|
|
func print() { markUsed("x = \(x)")}
|
|
}
|
|
// CHECK: define hidden {{.*}}void @_T017ProtocolContainer3foo{{[_0-9a-zA-Z]*}}F
|
|
// CHECK-NEXT: entry:
|
|
// CHECK-NEXT: %[[X:.*]] = alloca %P17ProtocolContainer9AProtocol_, align {{(4|8)}}
|
|
// CHECK: call void @llvm.dbg.declare(metadata %P17ProtocolContainer9AProtocol_* %[[X]], metadata ![[XMD:.*]], metadata !{{[0-9]+}})
|
|
// CHECK-NOT: !DILocalVariable({{.*}} name: "x"
|
|
// CHECK-NOT: !DILocalVariable({{.*}} name: "x"
|
|
func foo (_ x : AProtocol) {
|
|
var x = x
|
|
x.print() // Set breakpoint here
|
|
}
|
|
var aProtocol : AProtocol = AClass()
|
|
foo(aProtocol)
|