#include <string>
namespace llvm {
- class LLVMContext;
+ struct LLVMContext;
class Module;
}
namespace llvm {
class Module;
- class LLVMContext;
+ struct LLVMContext;
namespace sys { class Path; }
}
namespace clang {
namespace llvm {
class Type;
class Value;
- class LLVMContext;
+ struct LLVMContext;
}
namespace clang {
Elts.push_back(BuildDestroyHelper(Ty, NoteForHelper));
}
- C = llvm::ConstantStruct::get(Elts);
+ C = llvm::ConstantStruct::get(VMContext, Elts);
C = new llvm::GlobalVariable(CGM.getModule(), C->getType(), true,
llvm::GlobalValue::InternalLinkage,
Elts[0] = CGM.getNSConcreteGlobalBlock();
Elts[1] = llvm::ConstantInt::get(IntTy, flags|BLOCK_IS_GLOBAL);
- C = llvm::ConstantStruct::get(Elts);
+ C = llvm::ConstantStruct::get(VMContext, Elts);
char Name[32];
sprintf(Name, "__block_holder_tmp_%d", CGM.getGlobalUniqueCount());
Types[i+5] = ConvertType(Ty);
}
- llvm::StructType *Ty = llvm::StructType::get(Types, true);
+ llvm::StructType *Ty = llvm::StructType::get(VMContext, Types, true);
llvm::AllocaInst *A = CreateTempAlloca(Ty);
A->setAlignment(subBlockAlign);
// unsigned long reserved;
// unsigned long block_size;
// };
- BlockDescriptorType = llvm::StructType::get(UnsignedLongTy,
+ BlockDescriptorType = llvm::StructType::get(UnsignedLongTy->getContext(),
+ UnsignedLongTy,
UnsignedLongTy,
NULL);
// void (*__invoke)(void *);
// struct __block_descriptor *__descriptor;
// };
- GenericBlockLiteralType = llvm::StructType::get(PtrToInt8Ty,
+ GenericBlockLiteralType = llvm::StructType::get(IntTy->getContext(),
+ PtrToInt8Ty,
IntTy,
IntTy,
PtrToInt8Ty,
// void *__copy_func_helper_decl;
// void *__destroy_func_decl;
// };
- GenericExtendedBlockLiteralType = llvm::StructType::get(PtrToInt8Ty,
+ GenericExtendedBlockLiteralType = llvm::StructType::get(IntTy->getContext(),
+ PtrToInt8Ty,
IntTy,
IntTy,
PtrToInt8Ty,
llvm::ConstantInt::get(UnsignedLongTy,BlockLiteralSize);
llvm::Constant *DescriptorStruct =
- llvm::ConstantStruct::get(&DescriptorFields[0], 2);
+ llvm::ConstantStruct::get(VMContext, &DescriptorFields[0], 2);
llvm::GlobalVariable *Descriptor =
new llvm::GlobalVariable(getModule(), DescriptorStruct->getType(), true,
LiteralFields[4] = Descriptor;
llvm::Constant *BlockLiteralStruct =
- llvm::ConstantStruct::get(&LiteralFields[0], 5);
+ llvm::ConstantStruct::get(VMContext, &LiteralFields[0], 5);
llvm::GlobalVariable *BlockLiteral =
new llvm::GlobalVariable(getModule(), BlockLiteralStruct->getType(), true,
class TargetData;
class FunctionType;
class Value;
- class LLVMContext;
+ struct LLVMContext;
}
namespace clang {
assert((Align <= unsigned(Target.getPointerAlign(0))/8)
&& "Can't align more than pointer yet");
Types[needsCopyDispose*2 + 4] = LTy;
- return llvm::StructType::get(Types, false);
+ return llvm::StructType::get(VMContext, Types, false);
}
/// EmitLocalBlockVarDecl - Emit code and set up an entry in LocalDeclMap for a
return 0;
llvm::Constant *Result =
- llvm::ConstantStruct::get(Builder.Elements, Builder.Packed);
+ llvm::ConstantStruct::get(CGF->getLLVMContext(),
+ Builder.Elements, Builder.Packed);
assert(llvm::RoundUpToAlignment(Builder.NextFieldOffsetInBytes,
Builder.getAlignment(Result)) ==
Types.push_back(Ty);
}
- llvm::StructType* STy = llvm::StructType::get(Types, false);
+ llvm::StructType* STy = llvm::StructType::get(C->getType()->getContext(),
+ Types, false);
return llvm::ConstantStruct::get(STy, Elts);
}
std::vector<const llvm::Type*> Types;
for (unsigned i = 0; i < Elts.size(); ++i)
Types.push_back(Elts[i]->getType());
- const llvm::StructType *SType = llvm::StructType::get(Types, true);
+ const llvm::StructType *SType = llvm::StructType::get(AType->getContext(),
+ Types, true);
return llvm::ConstantStruct::get(SType, Elts);
}
Complex[1] = llvm::ConstantInt::get(VMContext,
Result.Val.getComplexIntImag());
- return llvm::ConstantStruct::get(Complex, 2);
+ return llvm::ConstantStruct::get(VMContext, Complex, 2);
}
case APValue::Float:
return llvm::ConstantFP::get(VMContext, Result.Val.getFloat());
Complex[1] = llvm::ConstantFP::get(VMContext,
Result.Val.getComplexFloatImag());
- return llvm::ConstantStruct::get(Complex, 2);
+ return llvm::ConstantStruct::get(VMContext, Complex, 2);
}
case APValue::Vector: {
llvm::SmallVector<llvm::Constant *, 4> Inits;
Ivars.push_back(MakeConstantString(Str));
Ivars.push_back(llvm::ConstantInt::get(IntTy, Str.size()));
llvm::Constant *ObjCStr = MakeGlobal(
- llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
+ llvm::StructType::get(VMContext, PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
Ivars, ".objc_str");
ConstantStrings.push_back(
llvm::ConstantExpr::getBitCast(ObjCStr, PtrToInt8Ty));
// Cast the pointer to a simplified version of the class structure
ReceiverClass = CGF.Builder.CreateBitCast(ReceiverClass,
llvm::PointerType::getUnqual(
- llvm::StructType::get(IdTy, IdTy, NULL)));
+ llvm::StructType::get(VMContext, IdTy, IdTy, NULL)));
// Get the superclass pointer
ReceiverClass = CGF.Builder.CreateStructGEP(ReceiverClass, 1);
// Load the superclass pointer
ReceiverClass = CGF.Builder.CreateLoad(ReceiverClass);
// Construct the structure used to look up the IMP
- llvm::StructType *ObjCSuperTy = llvm::StructType::get(Receiver->getType(),
- IdTy, NULL);
+ llvm::StructType *ObjCSuperTy = llvm::StructType::get(VMContext,
+ Receiver->getType(), IdTy, NULL);
llvm::Value *ObjCSuper = CGF.Builder.CreateAlloca(ObjCSuperTy);
CGF.Builder.CreateStore(Receiver, CGF.Builder.CreateStructGEP(ObjCSuper, 0));
const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes,
bool isClassMethodList) {
// Get the method structure type.
- llvm::StructType *ObjCMethodTy = llvm::StructType::get(
+ llvm::StructType *ObjCMethodTy = llvm::StructType::get(VMContext,
PtrToInt8Ty, // Really a selector, but the runtime creates it us.
PtrToInt8Ty, // Method types
llvm::PointerType::getUnqual(IMPTy), //Method pointer
llvm::SmallVector<const llvm::Type*, 16> ObjCMethodListFields;
llvm::PATypeHolder OpaqueNextTy = llvm::OpaqueType::get();
llvm::Type *NextPtrTy = llvm::PointerType::getUnqual(OpaqueNextTy);
- llvm::StructType *ObjCMethodListTy = llvm::StructType::get(NextPtrTy,
+ llvm::StructType *ObjCMethodListTy = llvm::StructType::get(VMContext,
+ NextPtrTy,
IntTy,
ObjCMethodArrayTy,
NULL);
const llvm::SmallVectorImpl<llvm::Constant *> &IvarTypes,
const llvm::SmallVectorImpl<llvm::Constant *> &IvarOffsets) {
// Get the method structure type.
- llvm::StructType *ObjCIvarTy = llvm::StructType::get(
+ llvm::StructType *ObjCIvarTy = llvm::StructType::get(VMContext,
PtrToInt8Ty,
PtrToInt8Ty,
IntTy,
Elements.push_back(llvm::ConstantInt::get(IntTy, (int)IvarNames.size()));
Elements.push_back(llvm::ConstantArray::get(ObjCIvarArrayTy, Ivars));
// Structure containing array and array count
- llvm::StructType *ObjCIvarListTy = llvm::StructType::get(IntTy,
+ llvm::StructType *ObjCIvarListTy = llvm::StructType::get(VMContext, IntTy,
ObjCIvarArrayTy,
NULL);
// Set up the class structure
// Note: Several of these are char*s when they should be ids. This is
// because the runtime performs this translation on load.
- llvm::StructType *ClassTy = llvm::StructType::get(
+ llvm::StructType *ClassTy = llvm::StructType::get(VMContext,
PtrToInt8Ty, // class_pointer
PtrToInt8Ty, // super_class
PtrToInt8Ty, // name
const llvm::SmallVectorImpl<llvm::Constant *> &MethodNames,
const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes) {
// Get the method structure type.
- llvm::StructType *ObjCMethodDescTy = llvm::StructType::get(
+ llvm::StructType *ObjCMethodDescTy = llvm::StructType::get(VMContext,
PtrToInt8Ty, // Really a selector, but the runtime does the casting for us.
PtrToInt8Ty,
NULL);
MethodNames.size());
llvm::Constant *Array = llvm::ConstantArray::get(ObjCMethodArrayTy,
Methods);
- llvm::StructType *ObjCMethodDescListTy = llvm::StructType::get(
+ llvm::StructType *ObjCMethodDescListTy = llvm::StructType::get(VMContext,
IntTy, ObjCMethodArrayTy, NULL);
Methods.clear();
Methods.push_back(llvm::ConstantInt::get(IntTy, MethodNames.size()));
const llvm::SmallVectorImpl<std::string> &Protocols) {
llvm::ArrayType *ProtocolArrayTy = llvm::ArrayType::get(PtrToInt8Ty,
Protocols.size());
- llvm::StructType *ProtocolListTy = llvm::StructType::get(
+ llvm::StructType *ProtocolListTy = llvm::StructType::get(VMContext,
PtrTy, //Should be a recurisve pointer, but it's always NULL here.
LongTy,//FIXME: Should be size_t
ProtocolArrayTy,
GenerateProtocolMethodList(EmptyConstantVector, EmptyConstantVector);
// Protocols are objects containing lists of the methods implemented and
// protocols adopted.
- llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy,
+ llvm::StructType *ProtocolTy = llvm::StructType::get(VMContext, IdTy,
PtrToInt8Ty,
ProtocolList->getType(),
InstanceMethodList->getType(),
GenerateProtocolMethodList(ClassMethodNames, ClassMethodTypes);
// Protocols are objects containing lists of the methods implemented and
// protocols adopted.
- llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy,
+ llvm::StructType *ProtocolTy = llvm::StructType::get(VMContext, IdTy,
PtrToInt8Ty,
ProtocolList->getType(),
InstanceMethodList->getType(),
Elements.push_back(llvm::ConstantExpr::getBitCast(
GenerateProtocolList(Protocols), PtrTy));
Categories.push_back(llvm::ConstantExpr::getBitCast(
- MakeGlobal(llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, PtrTy,
- PtrTy, PtrTy, NULL), Elements), PtrTy));
+ MakeGlobal(llvm::StructType::get(VMContext, PtrToInt8Ty, PtrToInt8Ty,
+ PtrTy, PtrTy, PtrTy, NULL), Elements), PtrTy));
}
void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
const llvm::Type *SelStructPtrTy = SelectorTy;
bool isSelOpaque = false;
if (SelStructTy == 0) {
- SelStructTy = llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, NULL);
+ SelStructTy = llvm::StructType::get(VMContext, PtrToInt8Ty,
+ PtrToInt8Ty, NULL);
SelStructPtrTy = llvm::PointerType::getUnqual(SelStructTy);
isSelOpaque = true;
}
Elements.push_back(llvm::ConstantArray::get(StaticsArrayTy,
ConstantStrings));
llvm::StructType *StaticsListTy =
- llvm::StructType::get(PtrToInt8Ty, StaticsArrayTy, NULL);
+ llvm::StructType::get(VMContext, PtrToInt8Ty, StaticsArrayTy, NULL);
llvm::Type *StaticsListPtrTy =
llvm::PointerType::getUnqual(StaticsListTy);
Statics = MakeGlobal(StaticsListTy, Elements, ".objc_statics");
// Array of classes, categories, and constant objects
llvm::ArrayType *ClassListTy = llvm::ArrayType::get(PtrToInt8Ty,
Classes.size() + Categories.size() + 2);
- llvm::StructType *SymTabTy = llvm::StructType::get(LongTy, SelStructPtrTy,
+ llvm::StructType *SymTabTy = llvm::StructType::get(VMContext,
+ LongTy, SelStructPtrTy,
llvm::Type::Int16Ty,
llvm::Type::Int16Ty,
ClassListTy, NULL);
// The symbol table is contained in a module which has some version-checking
// constants
- llvm::StructType * ModuleTy = llvm::StructType::get(LongTy, LongTy,
+ llvm::StructType * ModuleTy = llvm::StructType::get(VMContext, LongTy, LongTy,
PtrToInt8Ty, llvm::PointerType::getUnqual(SymTabTy), NULL);
Elements.clear();
// Runtime version used for compatibility checking.
ProtocolRefs.size()),
ProtocolRefs);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
llvm::GlobalVariable *GV =
CreateMetadataVar(Name, Init, "__OBJC,__cat_cls_meth,regular,no_dead_strip",
4, false);
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.PropertyTy,
Properties.size());
Values[2] = llvm::ConstantArray::get(AT, Properties);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
llvm::GlobalVariable *GV =
CreateMetadataVar(Name, Init,
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodDescriptionTy,
Methods.size());
Values[1] = llvm::ConstantArray::get(AT, Methods);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
return llvm::ConstantExpr::getBitCast(GV,
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarTy,
Ivars.size());
Values[1] = llvm::ConstantArray::get(AT, Ivars);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
llvm::GlobalVariable *GV;
if (ForClass)
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
Methods.size());
Values[2] = llvm::ConstantArray::get(AT, Methods);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
return llvm::ConstantExpr::getBitCast(GV,
NumClasses + NumCategories),
Symbols);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
llvm::GlobalVariable *GV =
CreateMetadataVar("\01L_OBJC_SYMBOLS", Init,
// char *name;
// char *attributes;
// }
- PropertyTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, NULL);
+ PropertyTy = llvm::StructType::get(VMContext, Int8PtrTy, Int8PtrTy, NULL);
CGM.getModule().addTypeName("struct._prop_t",
PropertyTy);
// uint32_t count_of_properties;
// struct _prop_t prop_list[count_of_properties];
// }
- PropertyListTy = llvm::StructType::get(IntTy,
+ PropertyListTy = llvm::StructType::get(VMContext, IntTy,
IntTy,
llvm::ArrayType::get(PropertyTy, 0),
NULL);
// char *method_type;
// char *_imp;
// }
- MethodTy = llvm::StructType::get(SelectorPtrTy,
+ MethodTy = llvm::StructType::get(VMContext, SelectorPtrTy,
Int8PtrTy,
Int8PtrTy,
NULL);
// char *types;
// }
MethodDescriptionTy =
- llvm::StructType::get(SelectorPtrTy,
+ llvm::StructType::get(VMContext, SelectorPtrTy,
Int8PtrTy,
NULL);
CGM.getModule().addTypeName("struct._objc_method_description",
// struct _objc_method_description[1];
// }
MethodDescriptionListTy =
- llvm::StructType::get(IntTy,
+ llvm::StructType::get(VMContext, IntTy,
llvm::ArrayType::get(MethodDescriptionTy, 0),
NULL);
CGM.getModule().addTypeName("struct._objc_method_description_list",
// struct _objc_property_list *instance_properties;
// }
ProtocolExtensionTy =
- llvm::StructType::get(IntTy,
+ llvm::StructType::get(VMContext, IntTy,
MethodDescriptionListPtrTy,
MethodDescriptionListPtrTy,
PropertyListPtrTy,
llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get();
const llvm::Type *T =
- llvm::StructType::get(llvm::PointerType::getUnqual(ProtocolListTyHolder),
+ llvm::StructType::get(VMContext,
+ llvm::PointerType::getUnqual(ProtocolListTyHolder),
LongTy,
llvm::ArrayType::get(ProtocolTyHolder, 0),
NULL);
// struct _objc_method_description_list *instance_methods;
// struct _objc_method_description_list *class_methods;
// }
- T = llvm::StructType::get(ProtocolExtensionPtrTy,
+ T = llvm::StructType::get(VMContext, ProtocolExtensionPtrTy,
Int8PtrTy,
llvm::PointerType::getUnqual(ProtocolListTyHolder),
MethodDescriptionListPtrTy,
// char *ivar_type;
// int ivar_offset;
// }
- IvarTy = llvm::StructType::get(Int8PtrTy,
+ IvarTy = llvm::StructType::get(VMContext, Int8PtrTy,
Int8PtrTy,
IntTy,
NULL);
// struct _objc_class_extension *
ClassExtensionTy =
- llvm::StructType::get(IntTy,
+ llvm::StructType::get(VMContext, IntTy,
Int8PtrTy,
PropertyListPtrTy,
NULL);
// char *ivar_layout;
// struct _objc_class_ext *ext;
// };
- T = llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
+ T = llvm::StructType::get(VMContext,
+ llvm::PointerType::getUnqual(ClassTyHolder),
llvm::PointerType::getUnqual(ClassTyHolder),
Int8PtrTy,
LongTy,
// uint32_t size; // sizeof(struct _objc_category)
// struct _objc_property_list *instance_properties;// category's @property
// }
- CategoryTy = llvm::StructType::get(Int8PtrTy,
+ CategoryTy = llvm::StructType::get(VMContext, Int8PtrTy,
Int8PtrTy,
MethodListPtrTy,
MethodListPtrTy,
// short cat_def_cnt;
// char *defs[cls_def_cnt + cat_def_cnt];
// }
- SymtabTy = llvm::StructType::get(LongTy,
+ SymtabTy = llvm::StructType::get(VMContext, LongTy,
SelectorPtrTy,
ShortTy,
ShortTy,
// struct _objc_symtab* symtab;
// }
ModuleTy =
- llvm::StructType::get(LongTy,
+ llvm::StructType::get(VMContext, LongTy,
LongTy,
Int8PtrTy,
SymtabPtrTy,
llvm::PointerType::getUnqual(llvm::Type::Int8Ty), 4);
ExceptionDataTy =
- llvm::StructType::get(llvm::ArrayType::get(llvm::Type::Int32Ty,
- SetJmpBufferSize),
+ llvm::StructType::get(VMContext, llvm::ArrayType::get(llvm::Type::Int32Ty,
+ SetJmpBufferSize),
StackPtrTy, NULL);
CGM.getModule().addTypeName("struct._objc_exception_data",
ExceptionDataTy);
// uint32_t method_count;
// struct _objc_method method_list[method_count];
// }
- MethodListnfABITy = llvm::StructType::get(IntTy,
+ MethodListnfABITy = llvm::StructType::get(VMContext, IntTy,
IntTy,
llvm::ArrayType::get(MethodTy, 0),
NULL);
// Holder for struct _protocol_list_t *
llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get();
- ProtocolnfABITy = llvm::StructType::get(ObjectPtrTy,
+ ProtocolnfABITy = llvm::StructType::get(VMContext, ObjectPtrTy,
Int8PtrTy,
llvm::PointerType::getUnqual(
ProtocolListTyHolder),
// long protocol_count; // Note, this is 32/64 bit
// struct _protocol_t *[protocol_count];
// }
- ProtocolListnfABITy = llvm::StructType::get(LongTy,
+ ProtocolListnfABITy = llvm::StructType::get(VMContext, LongTy,
llvm::ArrayType::get(
ProtocolnfABIPtrTy, 0),
NULL);
// uint32_t alignment;
// uint32_t size;
// }
- IvarnfABITy = llvm::StructType::get(llvm::PointerType::getUnqual(LongTy),
+ IvarnfABITy = llvm::StructType::get(VMContext,
+ llvm::PointerType::getUnqual(LongTy),
Int8PtrTy,
Int8PtrTy,
IntTy,
// uint32 count;
// struct _iver_t list[count];
// }
- IvarListnfABITy = llvm::StructType::get(IntTy,
+ IvarListnfABITy = llvm::StructType::get(VMContext, IntTy,
IntTy,
llvm::ArrayType::get(
IvarnfABITy, 0),
// }
// FIXME. Add 'reserved' field in 64bit abi mode!
- ClassRonfABITy = llvm::StructType::get(IntTy,
+ ClassRonfABITy = llvm::StructType::get(VMContext, IntTy,
IntTy,
IntTy,
Int8PtrTy,
llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get();
ClassnfABITy =
- llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
+ llvm::StructType::get(VMContext,
+ llvm::PointerType::getUnqual(ClassTyHolder),
llvm::PointerType::getUnqual(ClassTyHolder),
CachePtrTy,
llvm::PointerType::getUnqual(ImpnfABITy),
// const struct _protocol_list_t * const protocols;
// const struct _prop_list_t * const properties;
// }
- CategorynfABITy = llvm::StructType::get(Int8PtrTy,
+ CategorynfABITy = llvm::StructType::get(VMContext, Int8PtrTy,
ClassnfABIPtrTy,
MethodListnfABIPtrTy,
MethodListnfABIPtrTy,
// SUPER_IMP messenger;
// SEL name;
// };
- SuperMessageRefTy = llvm::StructType::get(ImpnfABITy,
+ SuperMessageRefTy = llvm::StructType::get(VMContext, ImpnfABITy,
SelectorPtrTy,
NULL);
CGM.getModule().addTypeName("struct._super_message_ref_t", SuperMessageRefTy);
// const char* name; // c++ typeinfo string
// Class cls;
// };
- EHTypeTy = llvm::StructType::get(llvm::PointerType::getUnqual(Int8PtrTy),
+ EHTypeTy = llvm::StructType::get(VMContext,
+ llvm::PointerType::getUnqual(Int8PtrTy),
Int8PtrTy,
ClassnfABIPtrTy,
NULL);
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
Methods.size());
Values[2] = llvm::ConstantArray::get(AT, Methods);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
llvm::GlobalVariable *GV =
new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarnfABITy,
Ivars.size());
Values[2] = llvm::ConstantArray::get(AT, Ivars);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
const char *Prefix = "\01l_OBJC_$_INSTANCE_VARIABLES_";
llvm::GlobalVariable *GV =
new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
ProtocolRefs.size()),
ProtocolRefs);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init,
std::vector<llvm::Constant*> Values(2);
Values[0] = Fn;
Values[1] = GetMethodVarName(Sel);
- llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+ llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::WeakAnyLinkage,
Init,
Builder.Layout(D);
- const llvm::Type *Ty = llvm::StructType::get(Builder.FieldTypes,
+ const llvm::Type *Ty = llvm::StructType::get(Types.getLLVMContext(),
+ Builder.FieldTypes,
Builder.Packed);
// Add all the field numbers.
else if (ResultRegTypes.size() == 1)
ResultType = ResultRegTypes[0];
else
- ResultType = llvm::StructType::get(ResultRegTypes);
+ ResultType = llvm::StructType::get(VMContext, ResultRegTypes);
const llvm::FunctionType *FTy =
llvm::FunctionType::get(ResultType, ArgTypes, false);
namespace llvm {
class BasicBlock;
- class LLVMContext;
+ struct LLVMContext;
class Module;
class SwitchInst;
class Value;
// Get the type of a ctor entry, { i32, void ()* }.
llvm::StructType* CtorStructTy =
- llvm::StructType::get(llvm::Type::Int32Ty,
+ llvm::StructType::get(VMContext, llvm::Type::Int32Ty,
llvm::PointerType::getUnqual(CtorFTy), NULL);
// Construct the constructor and destructor arrays.
llvm::ConstantExpr::getBitCast(unitGV, SBP),
llvm::ConstantInt::get(llvm::Type::Int32Ty, LineNo)
};
- return llvm::ConstantStruct::get(Fields, 4, false);
+ return llvm::ConstantStruct::get(VMContext, Fields, 4, false);
}
bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
class GlobalValue;
class TargetData;
class FunctionType;
- class LLVMContext;
+ struct LLVMContext;
}
namespace clang {
case Type::Complex: {
const llvm::Type *EltTy =
ConvertTypeRecursive(cast<ComplexType>(Ty).getElementType());
- return llvm::StructType::get(EltTy, EltTy, NULL);
+ return llvm::StructType::get(TheModule.getContext(), EltTy, EltTy, NULL);
}
case Type::LValueReference:
case Type::RValueReference: {
QualType ETy = cast<MemberPointerType>(Ty).getPointeeType();
if (ETy->isFunctionType()) {
- return llvm::StructType::get(ConvertType(Context.getPointerDiffType()),
+ return llvm::StructType::get(TheModule.getContext(),
+ ConvertType(Context.getPointerDiffType()),
ConvertType(Context.getPointerDiffType()),
NULL);
} else
#ifndef CLANG_CODEGEN_CODEGENTYPES_H
#define CLANG_CODEGEN_CODEGENTYPES_H
+#include "llvm/Module.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h"
#include <vector>
class PATypeHolder;
class TargetData;
class Type;
+ struct LLVMContext;
}
namespace clang {
TargetInfo &getTarget() const { return Target; }
ASTContext &getContext() const { return Context; }
const ABIInfo &getABIInfo() const;
+ llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
/// ConvertType - Convert type T into a llvm::Type.
const llvm::Type *ConvertType(QualType T);
// %st1.
case ComplexX87:
assert(Hi == ComplexX87 && "Unexpected ComplexX87 classification.");
- ResType = llvm::StructType::get(llvm::Type::X86_FP80Ty,
+ ResType = llvm::StructType::get(VMContext, llvm::Type::X86_FP80Ty,
llvm::Type::X86_FP80Ty,
NULL);
break;
case NoClass: break;
case Integer:
- ResType = llvm::StructType::get(ResType, llvm::Type::Int64Ty, NULL);
+ ResType = llvm::StructType::get(VMContext, ResType,
+ llvm::Type::Int64Ty, NULL);
break;
case SSE:
- ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
+ ResType = llvm::StructType::get(VMContext, ResType,
+ llvm::Type::DoubleTy, NULL);
break;
// AMD64-ABI 3.2.3p4: Rule 5. If the class is SSEUP, the eightbyte
// preceeded by X87. In such situations we follow gcc and pass the
// extra bits in an SSE reg.
if (Lo != X87)
- ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
+ ResType = llvm::StructType::get(VMContext, ResType,
+ llvm::Type::DoubleTy, NULL);
break;
}
case NoClass: break;
case Integer:
- ResType = llvm::StructType::get(ResType, llvm::Type::Int64Ty, NULL);
+ ResType = llvm::StructType::get(VMContext, ResType,
+ llvm::Type::Int64Ty, NULL);
++neededInt;
break;
// memory), except in situations involving unions.
case X87Up:
case SSE:
- ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
+ ResType = llvm::StructType::get(VMContext, ResType,
+ llvm::Type::DoubleTy, NULL);
++neededSSE;
break;
llvm::ConstantInt::get(llvm::Type::Int32Ty, 16));
const llvm::Type *DblPtrTy =
llvm::PointerType::getUnqual(llvm::Type::DoubleTy);
- const llvm::StructType *ST = llvm::StructType::get(llvm::Type::DoubleTy,
+ const llvm::StructType *ST = llvm::StructType::get(VMContext,
+ llvm::Type::DoubleTy,
llvm::Type::DoubleTy,
NULL);
llvm::Value *V, *Tmp = CGF.CreateTempAlloca(ST);
}
std::vector<const llvm::Type*> LLVMFields;
LLVMFields.push_back(llvm::ArrayType::get(ElemTy, SizeRegs));
- const llvm::Type* STy = llvm::StructType::get(LLVMFields, true);
+ const llvm::Type* STy = llvm::StructType::get(VMContext, LLVMFields, true);
return ABIArgInfo::getCoerce(STy);
}