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.
69 lines
2.7 KiB
Plaintext
69 lines
2.7 KiB
Plaintext
// RUN: %empty-directory(%t)
|
|
// RUN: %{python} %utils/chex.py < %s > %t/checkfile
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -emit-ir -o - -primary-file %s -import-objc-header %S/Inputs/error_domains.h > %t/out.ir
|
|
// RUN: %FileCheck --input-file=%t/out.ir %t/checkfile --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize -DINT=i%target-ptrsize
|
|
// REQUIRES: objc_codegen
|
|
|
|
sil_stage canonical
|
|
|
|
import Swift
|
|
import Foundation
|
|
|
|
sil public_external @take_metatype : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
sil @use_metatypes : $@convention(thin) () -> () {
|
|
bb0:
|
|
%take = function_ref @take_metatype : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
// CHECK: @"$sSo18NestedTypedefErroraMn" = linkonce_odr hidden constant
|
|
// CHECK-SAME: <i32 0x0006_0012>
|
|
// CHECK-SAME: @"$sSoMXM"
|
|
// CHECK-SAME: ptr @.str.28.Code_NNestedTypedefError_St_.nul12.nul32.nul35
|
|
|
|
// CHECK: @"$sSC14NestedTagErrorLeVMn" = linkonce_odr hidden constant
|
|
// CHECK-SAME: <i32 0x0006_0011>
|
|
// CHECK-SAME: @"$sSCMXM"
|
|
// CHECK-SAME: ptr @.str.28.TagError_NNestedTagError_Re_.nul16.nul32.nul35
|
|
|
|
// CHECK: @"$sSo13TypedefError2aMn" = linkonce_odr hidden constant
|
|
// CHECK-SAME: <i32 0x0006_0012>
|
|
// CHECK-SAME: @"$sSoMXM"
|
|
// CHECK-SAME: ptr @.str.23.Code_NTypedefError2_St_.nul12.nul27.nul30
|
|
|
|
// CHECK: @"$sSC13TypedefError1LEVMn" = linkonce_odr hidden constant
|
|
// CHECK-SAME: <i32 0x0006_0011>
|
|
// CHECK-SAME: @"$sSCMXM"
|
|
// CHECK-SAME: ptr @.str.17.TypedefError1_RE_.nul21.nul24
|
|
|
|
// CHECK: @"$sSo9TagError2VMn" = linkonce_odr hidden constant
|
|
// CHECK-SAME: <i32 0x0006_0012>
|
|
// CHECK-SAME: @"$sSoMXM"
|
|
// CHECK-SAME: ptr @.str.16.Code_NTagError2_.nul12.nul23
|
|
|
|
// CHECK: @"$sSC9TagError1LeVMn" = linkonce_odr hidden constant
|
|
// CHECK-SAME: <i32 0x0006_0011>
|
|
// CHECK-SAME: @"$sSCMXM"
|
|
// CHECK-SAME: ptr @.str.13.TagError1_Re_.nul17.nul20
|
|
|
|
%0 = metatype $@thick TagError1.Type
|
|
apply %take<TagError1>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
%1 = metatype $@thick TagError2.Code.Type
|
|
apply %take<TagError2.Code>(%1) : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
%2 = metatype $@thick TypedefError1.Type
|
|
apply %take<TypedefError1>(%2) : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
%3 = metatype $@thick TypedefError2.Code.Type
|
|
apply %take<TypedefError2.Code>(%3) : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
%4 = metatype $@thick Nested.TagError.Type
|
|
apply %take<Nested.TagError>(%4) : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
%5 = metatype $@thick Nested.TypedefError.Code.Type
|
|
apply %take<Nested.TypedefError.Code>(%5) : $@convention(thin) <T> (@thick T.Type) -> ()
|
|
|
|
%ret = tuple ()
|
|
return %ret : $()
|
|
}
|