Skip to content

Commit d579622

Browse files
authored
[clang][CGObjC] Prefer PointerType::get with LLVMContext over Type (NFC) (#133871)
Part of #123569
1 parent 92923e5 commit d579622

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

clang/lib/CodeGen/CGObjCMac.cpp

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,7 +2011,7 @@ CodeGen::RValue CGObjCMac::GenerateMessageSendSuper(
20112011
CGF.Builder.CreateStructGEP(ObjCSuper, 0));
20122012

20132013
// If this is a class message the metaclass is passed as the target.
2014-
llvm::Type *ClassTyPtr = llvm::PointerType::getUnqual(ObjCTypes.ClassTy);
2014+
llvm::Type *ClassTyPtr = llvm::PointerType::getUnqual(VMContext);
20152015
llvm::Value *Target;
20162016
if (IsClassMessage) {
20172017
if (isCategoryImpl) {
@@ -5657,7 +5657,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
56575657
IvarOffsetVarTy = LongTy;
56585658

56595659
ObjectPtrTy = cast<llvm::PointerType>(Types.ConvertType(Ctx.getObjCIdType()));
5660-
PtrObjectPtrTy = llvm::PointerType::getUnqual(ObjectPtrTy);
5660+
PtrObjectPtrTy = llvm::PointerType::getUnqual(VMContext);
56615661
SelectorPtrTy =
56625662
cast<llvm::PointerType>(Types.ConvertType(Ctx.getObjCSelType()));
56635663

@@ -5688,7 +5688,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
56885688
SuperPtrCTy = Ctx.getPointerType(SuperCTy);
56895689

56905690
SuperTy = cast<llvm::StructType>(Types.ConvertType(SuperCTy));
5691-
SuperPtrTy = llvm::PointerType::getUnqual(SuperTy);
5691+
SuperPtrTy = llvm::PointerType::getUnqual(VMContext);
56925692

56935693
// struct _prop_t {
56945694
// char *name;
@@ -5704,7 +5704,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
57045704
PropertyListTy = llvm::StructType::create(
57055705
"struct._prop_list_t", IntTy, IntTy, llvm::ArrayType::get(PropertyTy, 0));
57065706
// struct _prop_list_t *
5707-
PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy);
5707+
PropertyListPtrTy = llvm::PointerType::getUnqual(VMContext);
57085708

57095709
// struct _objc_method {
57105710
// SEL _cmd;
@@ -5716,7 +5716,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
57165716

57175717
// struct _objc_cache *
57185718
CacheTy = llvm::StructType::create(VMContext, "struct._objc_cache");
5719-
CachePtrTy = llvm::PointerType::getUnqual(CacheTy);
5719+
CachePtrTy = llvm::PointerType::getUnqual(VMContext);
57205720
}
57215721

57225722
ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
@@ -5737,8 +5737,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
57375737
llvm::ArrayType::get(MethodDescriptionTy, 0));
57385738

57395739
// struct _objc_method_description_list *
5740-
MethodDescriptionListPtrTy =
5741-
llvm::PointerType::getUnqual(MethodDescriptionListTy);
5740+
MethodDescriptionListPtrTy = llvm::PointerType::getUnqual(VMContext);
57425741

57435742
// Protocol description structures
57445743

@@ -5756,7 +5755,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
57565755
PropertyListPtrTy);
57575756

57585757
// struct _objc_protocol_extension *
5759-
ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(ProtocolExtensionTy);
5758+
ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(VMContext);
57605759

57615760
// Handle construction of Protocol and ProtocolList types
57625761

@@ -5779,9 +5778,9 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
57795778
"struct._objc_protocol_list");
57805779

57815780
// struct _objc_protocol_list *
5782-
ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy);
5781+
ProtocolListPtrTy = llvm::PointerType::getUnqual(VMContext);
57835782

5784-
ProtocolPtrTy = llvm::PointerType::getUnqual(ProtocolTy);
5783+
ProtocolPtrTy = llvm::PointerType::getUnqual(VMContext);
57855784

57865785
// Class description structures
57875786

@@ -5795,17 +5794,17 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
57955794

57965795
// struct _objc_ivar_list *
57975796
IvarListTy = llvm::StructType::create(VMContext, "struct._objc_ivar_list");
5798-
IvarListPtrTy = llvm::PointerType::getUnqual(IvarListTy);
5797+
IvarListPtrTy = llvm::PointerType::getUnqual(VMContext);
57995798

58005799
// struct _objc_method_list *
58015800
MethodListTy =
58025801
llvm::StructType::create(VMContext, "struct._objc_method_list");
5803-
MethodListPtrTy = llvm::PointerType::getUnqual(MethodListTy);
5802+
MethodListPtrTy = llvm::PointerType::getUnqual(VMContext);
58045803

58055804
// struct _objc_class_extension *
58065805
ClassExtensionTy = llvm::StructType::create(
58075806
"struct._objc_class_extension", IntTy, Int8PtrTy, PropertyListPtrTy);
5808-
ClassExtensionPtrTy = llvm::PointerType::getUnqual(ClassExtensionTy);
5807+
ClassExtensionPtrTy = llvm::PointerType::getUnqual(VMContext);
58095808

58105809
// struct _objc_class {
58115810
// Class isa;
@@ -5828,7 +5827,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58285827
Int8PtrTy, ClassExtensionPtrTy},
58295828
"struct._objc_class");
58305829

5831-
ClassPtrTy = llvm::PointerType::getUnqual(ClassTy);
5830+
ClassPtrTy = llvm::PointerType::getUnqual(VMContext);
58325831

58335832
// struct _objc_category {
58345833
// char *category_name;
@@ -5857,7 +5856,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58575856
SymtabTy = llvm::StructType::create("struct._objc_symtab", LongTy,
58585857
SelectorPtrTy, ShortTy, ShortTy,
58595858
llvm::ArrayType::get(Int8PtrTy, 0));
5860-
SymtabPtrTy = llvm::PointerType::getUnqual(SymtabTy);
5859+
SymtabPtrTy = llvm::PointerType::getUnqual(VMContext);
58615860

58625861
// struct _objc_module {
58635862
// long version;
@@ -5892,7 +5891,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
58925891
llvm::StructType::create("struct.__method_list_t", IntTy, IntTy,
58935892
llvm::ArrayType::get(MethodTy, 0));
58945893
// struct method_list_t *
5895-
MethodListnfABIPtrTy = llvm::PointerType::getUnqual(MethodListnfABITy);
5894+
MethodListnfABIPtrTy = llvm::PointerType::getUnqual(VMContext);
58965895

58975896
// struct _protocol_t {
58985897
// id isa; // NULL
@@ -5918,7 +5917,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
59185917
PropertyListPtrTy);
59195918

59205919
// struct _protocol_t*
5921-
ProtocolnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolnfABITy);
5920+
ProtocolnfABIPtrTy = llvm::PointerType::getUnqual(VMContext);
59225921

59235922
// struct _protocol_list_t {
59245923
// long protocol_count; // Note, this is 32/64 bit
@@ -5929,7 +5928,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
59295928
"struct._objc_protocol_list");
59305929

59315930
// struct _objc_protocol_list*
5932-
ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolListnfABITy);
5931+
ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual(VMContext);
59335932

59345933
// struct _ivar_t {
59355934
// unsigned [long] int *offset; // pointer to ivar offset location
@@ -5939,8 +5938,8 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
59395938
// uint32_t size;
59405939
// }
59415940
IvarnfABITy = llvm::StructType::create(
5942-
"struct._ivar_t", llvm::PointerType::getUnqual(IvarOffsetVarTy),
5943-
Int8PtrTy, Int8PtrTy, IntTy, IntTy);
5941+
"struct._ivar_t", llvm::PointerType::getUnqual(VMContext), Int8PtrTy,
5942+
Int8PtrTy, IntTy, IntTy);
59445943

59455944
// struct _ivar_list_t {
59465945
// uint32 entsize; // sizeof(struct _ivar_t)
@@ -5951,7 +5950,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
59515950
llvm::StructType::create("struct._ivar_list_t", IntTy, IntTy,
59525951
llvm::ArrayType::get(IvarnfABITy, 0));
59535952

5954-
IvarListnfABIPtrTy = llvm::PointerType::getUnqual(IvarListnfABITy);
5953+
IvarListnfABIPtrTy = llvm::PointerType::getUnqual(VMContext);
59555954

59565955
// struct _class_ro_t {
59575956
// uint32_t const flags;
@@ -5987,12 +5986,12 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
59875986
ClassnfABITy = llvm::StructType::create(
59885987
{llvm::PointerType::getUnqual(VMContext),
59895988
llvm::PointerType::getUnqual(VMContext), CachePtrTy,
5990-
llvm::PointerType::getUnqual(ImpnfABITy),
5991-
llvm::PointerType::getUnqual(ClassRonfABITy)},
5989+
llvm::PointerType::getUnqual(VMContext),
5990+
llvm::PointerType::getUnqual(VMContext)},
59925991
"struct._class_t");
59935992

59945993
// LLVM for struct _class_t *
5995-
ClassnfABIPtrTy = llvm::PointerType::getUnqual(ClassnfABITy);
5994+
ClassnfABIPtrTy = llvm::PointerType::getUnqual(VMContext);
59965995

59975996
// struct _category_t {
59985997
// const char * const name;
@@ -6036,7 +6035,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
60366035
MessageRefTy = cast<llvm::StructType>(Types.ConvertType(MessageRefCTy));
60376036

60386037
// MessageRefPtrTy - LLVM for struct _message_ref_t*
6039-
MessageRefPtrTy = llvm::PointerType::getUnqual(MessageRefTy);
6038+
MessageRefPtrTy = llvm::PointerType::getUnqual(VMContext);
60406039

60416040
// SuperMessageRefTy - LLVM for:
60426041
// struct _super_message_ref_t {
@@ -6047,17 +6046,17 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(
60476046
ImpnfABITy, SelectorPtrTy);
60486047

60496048
// SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
6050-
SuperMessageRefPtrTy = llvm::PointerType::getUnqual(SuperMessageRefTy);
6049+
SuperMessageRefPtrTy = llvm::PointerType::getUnqual(VMContext);
60516050

60526051
// struct objc_typeinfo {
60536052
// const void** vtable; // objc_ehtype_vtable + 2
60546053
// const char* name; // c++ typeinfo string
60556054
// Class cls;
60566055
// };
60576056
EHTypeTy = llvm::StructType::create("struct._objc_typeinfo",
6058-
llvm::PointerType::getUnqual(Int8PtrTy),
6057+
llvm::PointerType::getUnqual(VMContext),
60596058
Int8PtrTy, ClassnfABIPtrTy);
6060-
EHTypePtrTy = llvm::PointerType::getUnqual(EHTypeTy);
6059+
EHTypePtrTy = llvm::PointerType::getUnqual(VMContext);
60616060
}
60626061

60636062
llvm::Function *CGObjCNonFragileABIMac::ModuleInitFunction() {

0 commit comments

Comments
 (0)