Files
swift-mirror/test/IRGen/objc_int_encoding.sil
Joe Groff 08f9f11965 IRGen: Map Int and UInt to Clang types via NS[U]Integer.
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.
2016-05-02 16:11:36 -07:00

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 {}