From 7db6d838aad4083fe86d7bf703a75fe6e8a17856 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Tue, 28 Jul 2009 18:33:04 +0000 Subject: [PATCH] Update for LLVM API change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77349 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprConstant.cpp | 8 ++++---- lib/CodeGen/CGObjCGNU.cpp | 16 +++++++-------- lib/CodeGen/CGObjCMac.cpp | 36 +++++++++++++++++----------------- lib/CodeGen/CodeGenModule.cpp | 14 ++++++------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 6a14cae5e8..9976677c7b 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -438,7 +438,7 @@ public: return llvm::ConstantStruct::get(SType, Elts); } - return VMContext.getConstantArray(AType, Elts); + return llvm::ConstantArray::get(AType, Elts); } void InsertBitfieldIntoStruct(std::vector& Elts, @@ -610,7 +610,7 @@ public: InsertBitfieldIntoStruct(Elts, curField, ILE->getInit(0)); const llvm::ArrayType *RetTy = VMContext.getArrayType(NV->getType(), NumElts); - return VMContext.getConstantArray(RetTy, Elts); + return llvm::ConstantArray::get(RetTy, Elts); } llvm::Constant *InitElem; @@ -687,7 +687,7 @@ public: // This must be a string initializing an array in a static initializer. // Don't emit it as the address of the string, emit the string data itself // as an inline array. - return VMContext.getConstantArray(CGM.GetStringForStringLiteral(E), false); + return llvm::ConstantArray::get(CGM.GetStringForStringLiteral(E), false); } llvm::Constant *VisitObjCEncodeExpr(ObjCEncodeExpr *E) { @@ -701,7 +701,7 @@ public: // Resize the string to the right size, adding zeros at the end, or // truncating as needed. Str.resize(CAT->getSize().getZExtValue(), '\0'); - return VMContext.getConstantArray(Str, false); + return llvm::ConstantArray::get(Str, false); } llvm::Constant *VisitUnaryExtension(const UnaryOperator *E) { diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 4e326b530a..e5161577c3 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -290,7 +290,7 @@ llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl llvm::Constant *CGObjCGNU::MakeConstantString(const std::string &Str, const std::string &Name) { - llvm::Constant * ConstStr = VMContext.getConstantArray(Str); + llvm::Constant * ConstStr = llvm::ConstantArray::get(Str); ConstStr = new llvm::GlobalVariable(TheModule, ConstStr->getType(), true, llvm::GlobalValue::InternalLinkage, ConstStr, Name); @@ -304,7 +304,7 @@ llvm::Constant *CGObjCGNU::MakeGlobal(const llvm::StructType *Ty, } llvm::Constant *CGObjCGNU::MakeGlobal(const llvm::ArrayType *Ty, std::vector &V, const std::string &Name) { - llvm::Constant *C = VMContext.getConstantArray(Ty, V); + llvm::Constant *C = llvm::ConstantArray::get(Ty, V); return new llvm::GlobalVariable(TheModule, Ty, false, llvm::GlobalValue::InternalLinkage, C, Name); } @@ -521,7 +521,7 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const std::string &ClassName, // Array of method structures llvm::ArrayType *ObjCMethodArrayTy = VMContext.getArrayType(ObjCMethodTy, Methods.size()); - llvm::Constant *MethodArray = VMContext.getConstantArray(ObjCMethodArrayTy, + llvm::Constant *MethodArray = llvm::ConstantArray::get(ObjCMethodArrayTy, Methods); // Structure containing list pointer, array and array count @@ -578,7 +578,7 @@ llvm::Constant *CGObjCGNU::GenerateIvarList( Elements.clear(); Elements.push_back(llvm::ConstantInt::get(IntTy, (int)IvarNames.size())); - Elements.push_back(VMContext.getConstantArray(ObjCIvarArrayTy, Ivars)); + Elements.push_back(llvm::ConstantArray::get(ObjCIvarArrayTy, Ivars)); // Structure containing array and array count llvm::StructType *ObjCIvarListTy = VMContext.getStructType(IntTy, ObjCIvarArrayTy, @@ -660,7 +660,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolMethodList( } llvm::ArrayType *ObjCMethodArrayTy = VMContext.getArrayType(ObjCMethodDescTy, MethodNames.size()); - llvm::Constant *Array = VMContext.getConstantArray(ObjCMethodArrayTy, + llvm::Constant *Array = llvm::ConstantArray::get(ObjCMethodArrayTy, Methods); llvm::StructType *ObjCMethodDescListTy = VMContext.getStructType( IntTy, ObjCMethodArrayTy, NULL); @@ -689,7 +689,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolList( PtrToInt8Ty); Elements.push_back(Ptr); } - llvm::Constant * ProtocolArray = VMContext.getConstantArray(ProtocolArrayTy, + llvm::Constant * ProtocolArray = llvm::ConstantArray::get(ProtocolArrayTy, Elements); Elements.clear(); Elements.push_back(NULLPtr); @@ -1038,7 +1038,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { ConstantStrings.push_back(NULLPtr); Elements.push_back(MakeConstantString("NSConstantString", ".objc_static_class_name")); - Elements.push_back(VMContext.getConstantArray(StaticsArrayTy, + Elements.push_back(llvm::ConstantArray::get(StaticsArrayTy, ConstantStrings)); llvm::StructType *StaticsListTy = VMContext.getStructType(PtrToInt8Ty, StaticsArrayTy, NULL); @@ -1141,7 +1141,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { // NULL-terminated list of static object instances (mainly constant strings) Classes.push_back(Statics); Classes.push_back(NULLPtr); - llvm::Constant *ClassList = VMContext.getConstantArray(ClassListTy, Classes); + llvm::Constant *ClassList = llvm::ConstantArray::get(ClassListTy, Classes); Elements.push_back(ClassList); // Construct the symbol table llvm::Constant *SymTab= MakeGlobal(SymTabTy, Elements); diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index a212c9659f..6d9f4c03e5 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1769,7 +1769,7 @@ CGObjCMac::EmitProtocolList(const std::string &Name, Values[1] = llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1); Values[2] = - VMContext.getConstantArray(VMContext.getArrayType(ObjCTypes.ProtocolPtrTy, + llvm::ConstantArray::get(VMContext.getArrayType(ObjCTypes.ProtocolPtrTy, ProtocolRefs.size()), ProtocolRefs); @@ -1817,7 +1817,7 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(const std::string &Name, Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Properties.size()); llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.PropertyTy, Properties.size()); - Values[2] = VMContext.getConstantArray(AT, Properties); + Values[2] = llvm::ConstantArray::get(AT, Properties); llvm::Constant *Init = llvm::ConstantStruct::get(Values); llvm::GlobalVariable *GV = @@ -1857,7 +1857,7 @@ llvm::Constant *CGObjCMac::EmitMethodDescList(const std::string &Name, Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size()); llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodDescriptionTy, Methods.size()); - Values[1] = VMContext.getConstantArray(AT, Methods); + Values[1] = llvm::ConstantArray::get(AT, Methods); llvm::Constant *Init = llvm::ConstantStruct::get(Values); llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true); @@ -2229,7 +2229,7 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID, Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size()); llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.IvarTy, Ivars.size()); - Values[1] = VMContext.getConstantArray(AT, Ivars); + Values[1] = llvm::ConstantArray::get(AT, Ivars); llvm::Constant *Init = llvm::ConstantStruct::get(Values); llvm::GlobalVariable *GV; @@ -2289,7 +2289,7 @@ llvm::Constant *CGObjCMac::EmitMethodList(const std::string &Name, Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size()); llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodTy, Methods.size()); - Values[2] = VMContext.getConstantArray(AT, Methods); + Values[2] = llvm::ConstantArray::get(AT, Methods); llvm::Constant *Init = llvm::ConstantStruct::get(Values); llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true); @@ -2860,7 +2860,7 @@ void CGObjCMac::EmitImageInfo() { Section = "__DATA, __objc_imageinfo, regular, no_dead_strip"; llvm::GlobalVariable *GV = CreateMetadataVar("\01L_OBJC_IMAGE_INFO", - VMContext.getConstantArray(AT, values, 2), + llvm::ConstantArray::get(AT, values, 2), Section, 0, true); @@ -2919,7 +2919,7 @@ llvm::Constant *CGObjCMac::EmitModuleSymbols() { ObjCTypes.Int8PtrTy); Values[4] = - VMContext.getConstantArray(VMContext.getArrayType(ObjCTypes.Int8PtrTy, + llvm::ConstantArray::get(VMContext.getArrayType(ObjCTypes.Int8PtrTy, NumClasses + NumCategories), Symbols); @@ -2972,7 +2972,7 @@ llvm::Constant *CGObjCCommonMac::GetClassName(IdentifierInfo *Ident) { if (!Entry) Entry = CreateMetadataVar("\01L_OBJC_CLASS_NAME_", - VMContext.getConstantArray(Ident->getName()), + llvm::ConstantArray::get(Ident->getName()), "__TEXT,__cstring,cstring_literals", 1, true); @@ -3355,7 +3355,7 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout( if (ForStrongLayout && !BytesSkipped) return VMContext.getNullValue(PtrTy); llvm::GlobalVariable * Entry = CreateMetadataVar("\01L_OBJC_CLASS_NAME_", - VMContext.getConstantArray(BitMap.c_str()), + llvm::ConstantArray::get(BitMap.c_str()), "__TEXT,__cstring,cstring_literals", 1, true); return getConstantGEP(VMContext, Entry, 0, 0); @@ -3367,7 +3367,7 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarName(Selector Sel) { // FIXME: Avoid std::string copying. if (!Entry) Entry = CreateMetadataVar("\01L_OBJC_METH_VAR_NAME_", - VMContext.getConstantArray(Sel.getAsString()), + llvm::ConstantArray::get(Sel.getAsString()), "__TEXT,__cstring,cstring_literals", 1, true); @@ -3392,7 +3392,7 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarType(const FieldDecl *Field) { if (!Entry) Entry = CreateMetadataVar("\01L_OBJC_METH_VAR_TYPE_", - VMContext.getConstantArray(TypeStr), + llvm::ConstantArray::get(TypeStr), "__TEXT,__cstring,cstring_literals", 1, true); @@ -3408,7 +3408,7 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarType(const ObjCMethodDecl *D) { if (!Entry) Entry = CreateMetadataVar("\01L_OBJC_METH_VAR_TYPE_", - VMContext.getConstantArray(TypeStr), + llvm::ConstantArray::get(TypeStr), "__TEXT,__cstring,cstring_literals", 1, true); @@ -3421,7 +3421,7 @@ llvm::Constant *CGObjCCommonMac::GetPropertyName(IdentifierInfo *Ident) { if (!Entry) Entry = CreateMetadataVar("\01L_OBJC_PROP_NAME_ATTR_", - VMContext.getConstantArray(Ident->getName()), + llvm::ConstantArray::get(Ident->getName()), "__TEXT,__cstring,cstring_literals", 1, true); @@ -4069,7 +4069,7 @@ void CGObjCNonFragileABIMac::AddModuleClassList(const Symbols[i] = VMContext.getConstantExprBitCast(Container[i], ObjCTypes.Int8PtrTy); llvm::Constant* Init = - VMContext.getConstantArray(VMContext.getArrayType(ObjCTypes.Int8PtrTy, + llvm::ConstantArray::get(VMContext.getArrayType(ObjCTypes.Int8PtrTy, NumClasses), Symbols); @@ -4115,7 +4115,7 @@ void CGObjCNonFragileABIMac::FinishNonFragileABIModule() { if (CGM.getLangOptions().getGCMode() == LangOptions::GCOnly) flags |= eImageInfo_GCOnly; Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, flags); - llvm::Constant* Init = VMContext.getConstantArray( + llvm::Constant* Init = llvm::ConstantArray::get( VMContext.getArrayType(ObjCTypes.IntTy, 2), Values); llvm::GlobalVariable *IMGV = @@ -4596,7 +4596,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList( Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size()); llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodTy, Methods.size()); - Values[2] = VMContext.getConstantArray(AT, Methods); + Values[2] = llvm::ConstantArray::get(AT, Methods); llvm::Constant *Init = llvm::ConstantStruct::get(Values); llvm::GlobalVariable *GV = @@ -4722,7 +4722,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList( Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size()); llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.IvarnfABITy, Ivars.size()); - Values[2] = VMContext.getConstantArray(AT, Ivars); + Values[2] = llvm::ConstantArray::get(AT, Ivars); llvm::Constant *Init = llvm::ConstantStruct::get(Values); const char *Prefix = "\01l_OBJC_$_INSTANCE_VARIABLES_"; llvm::GlobalVariable *GV = @@ -4912,7 +4912,7 @@ CGObjCNonFragileABIMac::EmitProtocolList(const std::string &Name, Values[0] = llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1); Values[1] = - VMContext.getConstantArray( + llvm::ConstantArray::get( VMContext.getArrayType(ObjCTypes.ProtocolnfABIPtrTy, ProtocolRefs.size()), ProtocolRefs); diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index e35829cde3..91b071eb53 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -220,7 +220,7 @@ void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) { llvm::ArrayType *AT = VMContext.getArrayType(CtorStructTy, Ctors.size()); new llvm::GlobalVariable(TheModule, AT, false, llvm::GlobalValue::AppendingLinkage, - VMContext.getConstantArray(AT, Ctors), + llvm::ConstantArray::get(AT, Ctors), GlobalName); } } @@ -231,7 +231,7 @@ void CodeGenModule::EmitAnnotations() { // Create a new global variable for the ConstantStruct in the Module. llvm::Constant *Array = - VMContext.getConstantArray(VMContext.getArrayType(Annotations[0]->getType(), + llvm::ConstantArray::get(VMContext.getArrayType(Annotations[0]->getType(), Annotations.size()), Annotations); llvm::GlobalValue *gv = @@ -436,7 +436,7 @@ void CodeGenModule::EmitLLVMUsed() { llvm::GlobalVariable *GV = new llvm::GlobalVariable(getModule(), ATy, false, llvm::GlobalValue::AppendingLinkage, - VMContext.getConstantArray(ATy, UsedArray), + llvm::ConstantArray::get(ATy, UsedArray), "llvm.used"); GV->setSection("llvm.metadata"); @@ -484,8 +484,8 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV, // get [N x i8] constants for the annotation string, and the filename string // which are the 2nd and 3rd elements of the global annotation structure. const llvm::Type *SBP = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty); - llvm::Constant *anno = VMContext.getConstantArray(AA->getAnnotation(), true); - llvm::Constant *unit = VMContext.getConstantArray(M->getModuleIdentifier(), + llvm::Constant *anno = llvm::ConstantArray::get(AA->getAnnotation(), true); + llvm::Constant *unit = llvm::ConstantArray::get(M->getModuleIdentifier(), true); // Get the two global values corresponding to the ConstantArrays we just @@ -1301,7 +1301,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { // String pointer. CurField = NextField; NextField = *Field++; - llvm::Constant *C = VMContext.getConstantArray(Entry.getKey().str()); + llvm::Constant *C = llvm::ConstantArray::get(Entry.getKey().str()); const char *Sect, *Prefix; bool isConstant; @@ -1400,7 +1400,7 @@ static llvm::Constant *GenerateStringLiteral(const std::string &str, CodeGenModule &CGM, const char *GlobalName) { // Create Constant for this string literal. Don't add a '\0'. - llvm::Constant *C = CGM.getLLVMContext().getConstantArray(str, false); + llvm::Constant *C = llvm::ConstantArray::get(str, false); // Create a global variable for this string return new llvm::GlobalVariable(CGM.getModule(), C->getType(), constant, -- 2.40.0