@@ -1725,9 +1725,8 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
1725
1725
SmallVector<ObjCMethodDecl*, 16 > ClassMethods;
1726
1726
ClassMethods.insert (ClassMethods.begin (), OID->classmeth_begin (),
1727
1727
OID->classmeth_end ());
1728
- metaclassFields.addBitCast (
1729
- GenerateMethodList (className, " " , ClassMethods, true ),
1730
- PtrTy);
1728
+ metaclassFields.add (
1729
+ GenerateMethodList (className, " " , ClassMethods, true ));
1731
1730
}
1732
1731
// void *dtable;
1733
1732
metaclassFields.addNullPointer (PtrTy);
@@ -1894,9 +1893,9 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
1894
1893
if (InstanceMethods.size () == 0 )
1895
1894
classFields.addNullPointer (PtrTy);
1896
1895
else
1897
- classFields.addBitCast (
1898
- GenerateMethodList (className, " " , InstanceMethods, false ),
1899
- PtrTy);
1896
+ classFields.add (
1897
+ GenerateMethodList (className, " " , InstanceMethods, false ));
1898
+
1900
1899
// void *dtable;
1901
1900
classFields.addNullPointer (PtrTy);
1902
1901
// IMP cxx_construct;
@@ -2887,14 +2886,14 @@ GenerateMethodList(StringRef ClassName,
2887
2886
assert (FnPtr && " Can't generate metadata for method that doesn't exist" );
2888
2887
auto Method = MethodArray.beginStruct (ObjCMethodTy);
2889
2888
if (isV2ABI) {
2890
- Method.addBitCast (FnPtr, IMPTy );
2889
+ Method.add (FnPtr);
2891
2890
Method.add (GetConstantSelector (OMD->getSelector (),
2892
2891
Context.getObjCEncodingForMethodDecl (OMD)));
2893
2892
Method.add (MakeConstantString (Context.getObjCEncodingForMethodDecl (OMD, true )));
2894
2893
} else {
2895
2894
Method.add (MakeConstantString (OMD->getSelector ().getAsString ()));
2896
2895
Method.add (MakeConstantString (Context.getObjCEncodingForMethodDecl (OMD)));
2897
- Method.addBitCast (FnPtr, IMPTy );
2896
+ Method.add (FnPtr);
2898
2897
}
2899
2898
Method.finishAndAddTo (MethodArray);
2900
2899
}
@@ -2993,7 +2992,7 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure(
2993
2992
// Fill in the structure
2994
2993
2995
2994
// isa
2996
- Elements.addBitCast (MetaClass, PtrToInt8Ty );
2995
+ Elements.add (MetaClass);
2997
2996
// super_class
2998
2997
Elements.add (SuperClass);
2999
2998
// name
@@ -3022,7 +3021,7 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure(
3022
3021
// sibling_class
3023
3022
Elements.add (NULLPtr);
3024
3023
// protocols
3025
- Elements.addBitCast (Protocols, PtrTy );
3024
+ Elements.add (Protocols);
3026
3025
// gc_object_type
3027
3026
Elements.add (NULLPtr);
3028
3027
// abi_version
@@ -3094,7 +3093,7 @@ CGObjCGNU::GenerateProtocolList(ArrayRef<std::string> Protocols) {
3094
3093
} else {
3095
3094
protocol = value->getValue ();
3096
3095
}
3097
- Elements.addBitCast (protocol, PtrToInt8Ty );
3096
+ Elements.add (protocol);
3098
3097
}
3099
3098
Elements.finishAndAddTo (ProtocolList);
3100
3099
return ProtocolList.finishAndCreateGlobal (" .objc_protocol_list" ,
@@ -3224,11 +3223,9 @@ void CGObjCGNU::GenerateProtocolHolderCategory() {
3224
3223
Elements.add (MakeConstantString (CategoryName));
3225
3224
Elements.add (MakeConstantString (ClassName));
3226
3225
// Instance method list
3227
- Elements.addBitCast (GenerateMethodList (
3228
- ClassName, CategoryName, {}, false ), PtrTy);
3226
+ Elements.add (GenerateMethodList (ClassName, CategoryName, {}, false ));
3229
3227
// Class method list
3230
- Elements.addBitCast (GenerateMethodList (
3231
- ClassName, CategoryName, {}, true ), PtrTy);
3228
+ Elements.add (GenerateMethodList (ClassName, CategoryName, {}, true ));
3232
3229
3233
3230
// Protocol list
3234
3231
ConstantInitBuilder ProtocolListBuilder (CGM);
@@ -3238,13 +3235,11 @@ void CGObjCGNU::GenerateProtocolHolderCategory() {
3238
3235
auto ProtocolElements = ProtocolList.beginArray (PtrTy);
3239
3236
for (auto iter = ExistingProtocols.begin (), endIter = ExistingProtocols.end ();
3240
3237
iter != endIter ; iter++) {
3241
- ProtocolElements.addBitCast (iter->getValue (), PtrTy );
3238
+ ProtocolElements.add (iter->getValue ());
3242
3239
}
3243
3240
ProtocolElements.finishAndAddTo (ProtocolList);
3244
- Elements.addBitCast (
3245
- ProtocolList.finishAndCreateGlobal (" .objc_protocol_list" ,
3246
- CGM.getPointerAlign ()),
3247
- PtrTy);
3241
+ Elements.add (ProtocolList.finishAndCreateGlobal (" .objc_protocol_list" ,
3242
+ CGM.getPointerAlign ()));
3248
3243
Categories.push_back (
3249
3244
Elements.finishAndCreateGlobal (" " , CGM.getPointerAlign ()));
3250
3245
}
@@ -3321,27 +3316,26 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
3321
3316
SmallVector<ObjCMethodDecl*, 16 > InstanceMethods;
3322
3317
InstanceMethods.insert (InstanceMethods.begin (), OCD->instmeth_begin (),
3323
3318
OCD->instmeth_end ());
3324
- Elements.addBitCast (
3325
- GenerateMethodList (ClassName, CategoryName, InstanceMethods, false ),
3326
- PtrTy);
3319
+ Elements.add (
3320
+ GenerateMethodList (ClassName, CategoryName, InstanceMethods, false ));
3321
+
3327
3322
// Class method list
3328
3323
3329
3324
SmallVector<ObjCMethodDecl*, 16 > ClassMethods;
3330
3325
ClassMethods.insert (ClassMethods.begin (), OCD->classmeth_begin (),
3331
3326
OCD->classmeth_end ());
3332
- Elements.addBitCast (
3333
- GenerateMethodList (ClassName, CategoryName, ClassMethods, true ),
3334
- PtrTy);
3327
+ Elements.add (GenerateMethodList (ClassName, CategoryName, ClassMethods, true ));
3328
+
3335
3329
// Protocol list
3336
- Elements.addBitCast (GenerateCategoryProtocolList (CatDecl), PtrTy );
3330
+ Elements.add (GenerateCategoryProtocolList (CatDecl));
3337
3331
if (isRuntime (ObjCRuntime::GNUstep, 2 )) {
3338
3332
const ObjCCategoryDecl *Category =
3339
3333
Class->FindCategoryDeclaration (OCD->getIdentifier ());
3340
3334
if (Category) {
3341
3335
// Instance properties
3342
- Elements.addBitCast (GeneratePropertyList (OCD, Category, false ), PtrTy );
3336
+ Elements.add (GeneratePropertyList (OCD, Category, false ));
3343
3337
// Class properties
3344
- Elements.addBitCast (GeneratePropertyList (OCD, Category, true ), PtrTy );
3338
+ Elements.add (GeneratePropertyList (OCD, Category, true ));
3345
3339
} else {
3346
3340
Elements.addNullPointer (PtrTy);
3347
3341
Elements.addNullPointer (PtrTy);
@@ -3785,7 +3779,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
3785
3779
// Number of static selectors
3786
3780
symtab.addInt (LongTy, selectorCount);
3787
3781
3788
- symtab.addBitCast (selectorList, selStructPtrTy );
3782
+ symtab.add (selectorList);
3789
3783
3790
3784
// Number of classes defined.
3791
3785
symtab.addInt (CGM.Int16Ty , Classes.size ());
0 commit comments