@@ -5835,15 +5835,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
5835
5835
// struct _objc_protocol_extension *
5836
5836
ProtocolExtensionPtrTy = llvm::PointerType::getUnqual (ProtocolExtensionTy);
5837
5837
5838
- // Handle recursive construction of Protocol and ProtocolList types
5839
-
5840
- ProtocolTy =
5841
- llvm::StructType::create (VMContext, " struct._objc_protocol" );
5842
-
5843
- ProtocolListTy =
5844
- llvm::StructType::create (VMContext, " struct._objc_protocol_list" );
5845
- ProtocolListTy->setBody (llvm::PointerType::getUnqual (ProtocolListTy), LongTy,
5846
- llvm::ArrayType::get (ProtocolTy, 0 ));
5838
+ // Handle construction of Protocol and ProtocolList types
5847
5839
5848
5840
// struct _objc_protocol {
5849
5841
// struct _objc_protocol_extension *isa;
@@ -5852,9 +5844,16 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
5852
5844
// struct _objc_method_description_list *instance_methods;
5853
5845
// struct _objc_method_description_list *class_methods;
5854
5846
// }
5855
- ProtocolTy->setBody (ProtocolExtensionPtrTy, Int8PtrTy,
5856
- llvm::PointerType::getUnqual (ProtocolListTy),
5857
- MethodDescriptionListPtrTy, MethodDescriptionListPtrTy);
5847
+ ProtocolTy = llvm::StructType::create (
5848
+ {ProtocolExtensionPtrTy, Int8PtrTy,
5849
+ llvm::PointerType::getUnqual (VMContext), MethodDescriptionListPtrTy,
5850
+ MethodDescriptionListPtrTy},
5851
+ " struct._objc_protocol" );
5852
+
5853
+ ProtocolListTy =
5854
+ llvm::StructType::create ({llvm::PointerType::getUnqual (VMContext), LongTy,
5855
+ llvm::ArrayType::get (ProtocolTy, 0 )},
5856
+ " struct._objc_protocol_list" );
5858
5857
5859
5858
// struct _objc_protocol_list *
5860
5859
ProtocolListPtrTy = llvm::PointerType::getUnqual (ProtocolListTy);
@@ -5886,8 +5885,6 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
5886
5885
" struct._objc_class_extension" , IntTy, Int8PtrTy, PropertyListPtrTy);
5887
5886
ClassExtensionPtrTy = llvm::PointerType::getUnqual (ClassExtensionTy);
5888
5887
5889
- ClassTy = llvm::StructType::create (VMContext, " struct._objc_class" );
5890
-
5891
5888
// struct _objc_class {
5892
5889
// Class isa;
5893
5890
// Class super_class;
@@ -5902,10 +5899,12 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
5902
5899
// char *ivar_layout;
5903
5900
// struct _objc_class_ext *ext;
5904
5901
// };
5905
- ClassTy->setBody (llvm::PointerType::getUnqual (ClassTy),
5906
- llvm::PointerType::getUnqual (ClassTy), Int8PtrTy, LongTy,
5907
- LongTy, LongTy, IvarListPtrTy, MethodListPtrTy, CachePtrTy,
5908
- ProtocolListPtrTy, Int8PtrTy, ClassExtensionPtrTy);
5902
+ ClassTy = llvm::StructType::create (
5903
+ {llvm::PointerType::getUnqual (VMContext),
5904
+ llvm::PointerType::getUnqual (VMContext), Int8PtrTy, LongTy, LongTy,
5905
+ LongTy, IvarListPtrTy, MethodListPtrTy, CachePtrTy, ProtocolListPtrTy,
5906
+ Int8PtrTy, ClassExtensionPtrTy},
5907
+ " struct._objc_class" );
5909
5908
5910
5909
ClassPtrTy = llvm::PointerType::getUnqual (ClassTy);
5911
5910
@@ -5988,13 +5987,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
5988
5987
// const struct _prop_list_t * class_properties;
5989
5988
// }
5990
5989
5991
- // Holder for struct _protocol_list_t *
5992
- ProtocolListnfABITy =
5993
- llvm::StructType::create (VMContext, " struct._objc_protocol_list" );
5994
-
5995
5990
ProtocolnfABITy = llvm::StructType::create (
5996
5991
" struct._protocol_t" , ObjectPtrTy, Int8PtrTy,
5997
- llvm::PointerType::getUnqual (ProtocolListnfABITy ), MethodListnfABIPtrTy,
5992
+ llvm::PointerType::getUnqual (VMContext ), MethodListnfABIPtrTy,
5998
5993
MethodListnfABIPtrTy, MethodListnfABIPtrTy, MethodListnfABIPtrTy,
5999
5994
PropertyListPtrTy, IntTy, IntTy, Int8PtrPtrTy, Int8PtrTy,
6000
5995
PropertyListPtrTy);
@@ -6006,8 +6001,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
6006
6001
// long protocol_count; // Note, this is 32/64 bit
6007
6002
// struct _protocol_t *[protocol_count];
6008
6003
// }
6009
- ProtocolListnfABITy->setBody (LongTy,
6010
- llvm::ArrayType::get (ProtocolnfABIPtrTy, 0 ));
6004
+ ProtocolListnfABITy = llvm::StructType::create (
6005
+ {LongTy, llvm::ArrayType::get (ProtocolnfABIPtrTy, 0 )},
6006
+ " struct._objc_protocol_list" );
6011
6007
6012
6008
// struct _objc_protocol_list*
6013
6009
ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual (ProtocolListnfABITy);
@@ -6067,11 +6063,12 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
6067
6063
// struct class_ro_t *ro;
6068
6064
// }
6069
6065
6070
- ClassnfABITy = llvm::StructType::create (VMContext, " struct._class_t" );
6071
- ClassnfABITy->setBody (llvm::PointerType::getUnqual (ClassnfABITy),
6072
- llvm::PointerType::getUnqual (ClassnfABITy), CachePtrTy,
6073
- llvm::PointerType::getUnqual (ImpnfABITy),
6074
- llvm::PointerType::getUnqual (ClassRonfABITy));
6066
+ ClassnfABITy = llvm::StructType::create (
6067
+ {llvm::PointerType::getUnqual (VMContext),
6068
+ llvm::PointerType::getUnqual (VMContext), CachePtrTy,
6069
+ llvm::PointerType::getUnqual (ImpnfABITy),
6070
+ llvm::PointerType::getUnqual (ClassRonfABITy)},
6071
+ " struct._class_t" );
6075
6072
6076
6073
// LLVM for struct _class_t *
6077
6074
ClassnfABIPtrTy = llvm::PointerType::getUnqual (ClassnfABITy);
0 commit comments