File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -961,6 +961,14 @@ void IRGenModule::emitFieldMetadataRecord(const NominalTypeDecl *Decl) {
961
961
if (!IRGen.Opts .EnableReflectionMetadata )
962
962
return ;
963
963
964
+ // @objc enums never have generic parameters or payloads,
965
+ // and lower as their raw type.
966
+ if (auto *ED = dyn_cast<EnumDecl>(Decl))
967
+ if (ED->isObjC ()) {
968
+ emitOpaqueTypeMetadataRecord (ED);
969
+ return ;
970
+ }
971
+
964
972
FieldTypeMetadataBuilder builder (*this , Decl);
965
973
builder.emit ();
966
974
}
Original file line number Diff line number Diff line change @@ -11,3 +11,13 @@ public class HasObjCClasses {
11
11
12
12
public class NSObjectSubclass : NSObject { }
13
13
14
+ @objc public enum ObjCEnum : Int {
15
+ case first
16
+ case second
17
+ }
18
+
19
+ public struct HasObjCEnum {
20
+ let optionalEnum : ObjCEnum ?
21
+ let reference : AnyObject
22
+ }
23
+
Original file line number Diff line number Diff line change 19
19
// CHECK: (class TypeLowering.NSObjectSubclass)
20
20
// CHECK-NEXT: (reference kind=strong refcounting=unknown)
21
21
22
+ 12 TypeLowering11 HasObjCEnumV
23
+ // CHECK: (struct size=24 alignment=8 stride=24 num_extra_inhabitants=0
24
+ // CHECK-NEXT: (field name=optionalEnum offset=0
25
+ // CHECK-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
26
+ // CHECK-NEXT: (field name=some offset=0
27
+ // CHECK-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))
28
+ // CHECK-NEXT: (field name=reference offset=16
29
+ // CHECK-NEXT: (class_existential size=8 alignment=8 stride=8 num_extra_inhabitants=2147483647
30
+ // CHECK-NEXT: (field name=object offset=0
31
+ // CHECK-NEXT: (reference kind=strong refcounting=unknown)))))
You can’t perform that action at this time.
0 commit comments