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.
22 lines
642 B
Plaintext
22 lines
642 B
Plaintext
// RUN: %target-swift-frontend -enable-objc-interop -I %S/../Inputs/custom-modules %s -emit-ir | %FileCheck %s
|
|
// REQUIRES: objc_codegen
|
|
|
|
sil_stage raw
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
import ObjCRuntimeVisible
|
|
|
|
// CHECK: [[CLASS_NAME:@.*]] = private unnamed_addr constant [22 x i8] c"MyRuntimeVisibleClass\00"
|
|
|
|
// CHECK: define {{(dllexport )?}}{{(protected )?}}swiftcc ptr @getClassA() #0 {
|
|
sil @getClassA : $@convention(thin) () -> @objc_metatype A.Type {
|
|
bb0:
|
|
// CHECK: call ptr @objc_lookUpClass(ptr [[CLASS_NAME]])
|
|
%0 = metatype $@objc_metatype A.Type
|
|
|
|
// CHECK-NEXT: ret ptr
|
|
return %0 : $@objc_metatype A.Type
|
|
}
|