mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
If NSInteger and NSUInteger typedefs are available in the current Clang context, use them when mapping Swift's Int and UInt to Clang types. This gives us consistent method and property type encodings for @objc methods with Clang, fixing rdar://problem/17506068.
33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
|
|
// REQUIRES: objc_interop
|
|
|
|
// CHECK: [[SELECTOR:@.*]] = private global {{.*}} c"fooWithX:\00"
|
|
|
|
// CHECK-64: [[INT_UINT_METHOD_ENCODING:@.*]] = private unnamed_addr constant {{.*}} c"Q24@0:8q16\00"
|
|
// CHECK-32: [[INT_UINT_METHOD_ENCODING:@.*]] = private unnamed_addr constant {{.*}} c"I12@0:4i8\00"
|
|
|
|
// CHECK: @_INSTANCE_METHODS__TtC17objc_int_encoding3Foo = private constant {{.*}} [[SELECTOR]], {{.*}} [[INT_UINT_METHOD_ENCODING]], {{.*}} @_TToFC17objc_int_encoding3Foo3foofT1xSi_Su
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import Foundation
|
|
|
|
class Foo: NSObject {
|
|
@objc override init() {}
|
|
|
|
@objc func foo(x: Int) -> UInt
|
|
}
|
|
|
|
sil hidden @_TToFC17objc_int_encoding3Foo3foofT1xSi_Su : $@convention(objc_method) (Int, @guaranteed Foo) -> UInt {
|
|
entry(%0 : $Int, %1 : $Foo):
|
|
unreachable
|
|
}
|
|
sil @_TToFC17objc_int_encoding3FoocfT_S0_ : $@convention(objc_method) (@owned Foo) -> @owned Foo {
|
|
entry(%1 : $Foo):
|
|
unreachable
|
|
}
|
|
|
|
sil_vtable Foo {}
|