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.
30 lines
768 B
Swift
30 lines
768 B
Swift
// RUN: %target-swift-frontend -primary-file %s -enable-objc-interop -emit-ir | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
|
|
// REQUIRES: objc_codegen
|
|
|
|
// https://github.com/apple/swift/issues/43667
|
|
|
|
// CHECK-64: @_DATA__TtC23objc_class_empty_fields14OneEnumWrapper = internal constant { {{.*}} } { i32 {{[0-9]+}}, i32 16, i32 24
|
|
// CHECK-32: @_DATA__TtC23objc_class_empty_fields14OneEnumWrapper = internal constant { {{.*}} } { i32 {{[0-9]+}}, i32 8, i32 12
|
|
|
|
enum OneCaseEnum {
|
|
case X
|
|
}
|
|
|
|
class OneEnumWrapper {
|
|
var myVar: OneCaseEnum
|
|
var whyVar: OneCaseEnum
|
|
var x: Int
|
|
|
|
init(v: OneCaseEnum)
|
|
{
|
|
self.myVar = v
|
|
self.whyVar = v
|
|
self.x = 0
|
|
}
|
|
}
|
|
|
|
let e = OneCaseEnum.X
|
|
print(e)
|
|
let x = OneEnumWrapper(v: e)
|
|
print(x)
|