@@ -5835,15 +5835,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58355835 // struct _objc_protocol_extension *
58365836 ProtocolExtensionPtrTy = llvm::PointerType::getUnqual (ProtocolExtensionTy);
58375837
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
58475839
58485840 // struct _objc_protocol {
58495841 // struct _objc_protocol_extension *isa;
@@ -5852,9 +5844,16 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58525844 // struct _objc_method_description_list *instance_methods;
58535845 // struct _objc_method_description_list *class_methods;
58545846 // }
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" );
58585857
58595858 // struct _objc_protocol_list *
58605859 ProtocolListPtrTy = llvm::PointerType::getUnqual (ProtocolListTy);
@@ -5886,8 +5885,6 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58865885 " struct._objc_class_extension" , IntTy, Int8PtrTy, PropertyListPtrTy);
58875886 ClassExtensionPtrTy = llvm::PointerType::getUnqual (ClassExtensionTy);
58885887
5889- ClassTy = llvm::StructType::create (VMContext, " struct._objc_class" );
5890-
58915888 // struct _objc_class {
58925889 // Class isa;
58935890 // Class super_class;
@@ -5902,10 +5899,12 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
59025899 // char *ivar_layout;
59035900 // struct _objc_class_ext *ext;
59045901 // };
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" );
59095908
59105909 ClassPtrTy = llvm::PointerType::getUnqual (ClassTy);
59115910
@@ -5988,13 +5987,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
59885987 // const struct _prop_list_t * class_properties;
59895988 // }
59905989
5991- // Holder for struct _protocol_list_t *
5992- ProtocolListnfABITy =
5993- llvm::StructType::create (VMContext, " struct._objc_protocol_list" );
5994-
59955990 ProtocolnfABITy = llvm::StructType::create (
59965991 " struct._protocol_t" , ObjectPtrTy, Int8PtrTy,
5997- llvm::PointerType::getUnqual (ProtocolListnfABITy ), MethodListnfABIPtrTy,
5992+ llvm::PointerType::getUnqual (VMContext ), MethodListnfABIPtrTy,
59985993 MethodListnfABIPtrTy, MethodListnfABIPtrTy, MethodListnfABIPtrTy,
59995994 PropertyListPtrTy, IntTy, IntTy, Int8PtrPtrTy, Int8PtrTy,
60005995 PropertyListPtrTy);
@@ -6006,8 +6001,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
60066001 // long protocol_count; // Note, this is 32/64 bit
60076002 // struct _protocol_t *[protocol_count];
60086003 // }
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" );
60116007
60126008 // struct _objc_protocol_list*
60136009 ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual (ProtocolListnfABITy);
@@ -6067,11 +6063,12 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
60676063 // struct class_ro_t *ro;
60686064 // }
60696065
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" );
60756072
60766073 // LLVM for struct _class_t *
60776074 ClassnfABIPtrTy = llvm::PointerType::getUnqual (ClassnfABITy);
0 commit comments