mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Clang does not accept `-x objective-c` with WebAssembly target and it crashes with "Objective-C support is unimplemented for object file format" for now. `-enable-objc-interop` can work without the objc runtime support (which is indicated by `objc_interop` feature), so this adds a new `objc_codegen` feature to require Objective-C support only at compile-time.
33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
|
|
// REQUIRES: objc_codegen
|
|
|
|
// 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 = internal constant {{.*}} [[SELECTOR]], {{.*}} [[INT_UINT_METHOD_ENCODING]], {{.*}} @"$s17objc_int_encoding3FooC3foo1xSuSi_tFTo{{(\.ptrauth)?}}"
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import Foundation
|
|
|
|
class Foo: NSObject {
|
|
@objc override init() {}
|
|
|
|
@objc func foo(x: Int) -> UInt
|
|
}
|
|
|
|
sil hidden @$s17objc_int_encoding3FooC3foo1xSuSi_tFTo : $@convention(objc_method) (Int, @guaranteed Foo) -> UInt {
|
|
entry(%0 : $Int, %1 : $Foo):
|
|
unreachable
|
|
}
|
|
sil @$s17objc_int_encoding3FooCACycfcTo : $@convention(objc_method) (@owned Foo) -> @owned Foo {
|
|
entry(%1 : $Foo):
|
|
unreachable
|
|
}
|
|
|
|
sil_vtable Foo {}
|