| // RUN: %swift -swift-version 4 -target arm64e-apple-ios12.0 -parse-stdlib -parse-as-library %s -emit-ir -module-name test -Xcc -Xclang -Xcc -fptrauth-calls | %FileCheck %s --check-prefix=CHECK |
| // REQUIRES: objc_interop |
| |
| // REQUIRES: CPU=arm64e |
| // REQUIRES: OS=ios |
| |
| // CHECK: @"$sTa.ptrauth" = private constant { i8*, i32, i64, i64 } { i8* bitcast (void (%swift.refcounted*)* @"$sTa" to i8*), i32 0, i64 0, i64 {{.*}} }, section "llvm.ptrauth" |
| |
| @objc class A { |
| @objc func foo() {} |
| } |
| |
| sil_vtable A {} |
| |
| sil hidden @$s4test1AC3fooyyF : $@convention(method) (@guaranteed A) -> () { |
| bb0(%0 : $A): |
| unreachable |
| } |
| sil hidden [thunk] @$s4test1AC3fooyyFTo : $@convention(objc_method) (A) -> () { |
| bb0(%0 : $A): |
| unreachable |
| } |
| |
| // It would also be reasonable to not apply ptrauth here, but as long as we're partial_apply |
| // CHECK-LABEL: define swiftcc void @test0( |
| // CHECK: call swiftcc void bitcast ({ i8*, i32, i64, i64 }* @"$sTa.ptrauth" to void (%swift.refcounted*)*)(%swift.refcounted* swiftself {{%.*}}) [ "ptrauth"(i32 0, i64 {{.*}}) ] |
| sil @test0 : $@convention(thin) (@guaranteed A) -> () { |
| bb0(%0: $A): |
| %method = objc_method %0 : $A, #A.foo!foreign, $@convention(objc_method) (A) -> () |
| %partial = partial_apply [callee_guaranteed] %method(%0) : $@convention(objc_method) (A) -> () |
| apply %partial() : $ @callee_guaranteed () -> () |
| %result = tuple () |
| return %result : $() |
| } |