diff options
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Core.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/VMCore/Function.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/VMCore/IRBuilder.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/VMCore/Module.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/VMCore/Type.cpp | 22 |
6 files changed, 32 insertions, 18 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 1529c4ad481..57498b48592 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -619,7 +619,7 @@ Constant *ConstantArray::get(LLVMContext &Context, StringRef Str, StructType *ConstantStruct::getTypeForElements(LLVMContext &Context, ArrayRef<Constant*> V, bool Packed) { - SmallVector<Type*, 16> EltTypes; + SmallVector<const Type*, 16> EltTypes; for (unsigned i = 0, e = V.size(); i != e; ++i) EltTypes.push_back(V[i]->getType()); diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index 15d27233f22..d9ced94134a 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -260,7 +260,7 @@ LLVMTypeRef LLVMX86MMXType(void) { LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg) { - std::vector<Type*> Tys; + std::vector<const Type*> Tys; for (LLVMTypeRef *I = ParamTypes, *E = ParamTypes + ParamCount; I != E; ++I) Tys.push_back(unwrap(*I)); @@ -290,7 +290,7 @@ void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest) { LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed) { - std::vector<Type*> Tys; + std::vector<const Type*> Tys; for (LLVMTypeRef *I = ElementTypes, *E = ElementTypes + ElementCount; I != E; ++I) Tys.push_back(unwrap(*I)); diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index bde6a6d6918..972319e7402 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -333,7 +333,7 @@ unsigned Function::getIntrinsicID() const { return 0; } -std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) { +std::string Intrinsic::getName(ID id, const Type **Tys, unsigned numTys) { assert(id < num_intrinsics && "Invalid intrinsic ID!"); static const char * const Table[] = { "not_intrinsic", @@ -356,10 +356,10 @@ std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) { } const FunctionType *Intrinsic::getType(LLVMContext &Context, - ID id, Type **Tys, + ID id, const Type **Tys, unsigned numTys) { const Type *ResultTy = NULL; - std::vector<Type*> ArgTys; + std::vector<const Type*> ArgTys; bool IsVarArg = false; #define GET_INTRINSIC_GENERATOR @@ -384,7 +384,7 @@ bool Intrinsic::isOverloaded(ID id) { #include "llvm/Intrinsics.gen" #undef GET_INTRINSIC_ATTRIBUTES -Function *Intrinsic::getDeclaration(Module *M, ID id, Type **Tys, +Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys, unsigned numTys) { // There can never be multiple globals with the same name of different types, // because intrinsics must be a specific type. diff --git a/llvm/lib/VMCore/IRBuilder.cpp b/llvm/lib/VMCore/IRBuilder.cpp index 0908470216f..f2d469a2d84 100644 --- a/llvm/lib/VMCore/IRBuilder.cpp +++ b/llvm/lib/VMCore/IRBuilder.cpp @@ -65,7 +65,7 @@ CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align, bool isVolatile, MDNode *TBAATag) { Ptr = getCastedInt8PtrValue(Ptr); Value *Ops[] = { Ptr, Val, Size, getInt32(Align), getInt1(isVolatile) }; - Type *Tys[] = { Ptr->getType(), Size->getType() }; + const Type *Tys[] = { Ptr->getType(), Size->getType() }; Module *M = BB->getParent()->getParent(); Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys, 2); @@ -85,7 +85,7 @@ CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align, Src = getCastedInt8PtrValue(Src); Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) }; - Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() }; + const Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() }; Module *M = BB->getParent()->getParent(); Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy, Tys, 3); @@ -105,7 +105,7 @@ CreateMemMove(Value *Dst, Value *Src, Value *Size, unsigned Align, Src = getCastedInt8PtrValue(Src); Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) }; - Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() }; + const Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() }; Module *M = BB->getParent()->getParent(); Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memmove, Tys, 3); diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index 8a738cbac5c..1ca70161d6d 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -216,8 +216,8 @@ Constant *Module::getOrInsertFunction(StringRef Name, va_start(Args, RetTy); // Build the list of argument types... - std::vector<Type*> ArgTys; - while (Type *ArgTy = va_arg(Args, Type*)) + std::vector<const Type*> ArgTys; + while (const Type *ArgTy = va_arg(Args, const Type*)) ArgTys.push_back(ArgTy); va_end(Args); @@ -234,8 +234,8 @@ Constant *Module::getOrInsertFunction(StringRef Name, va_start(Args, RetTy); // Build the list of argument types... - std::vector<Type*> ArgTys; - while (Type *ArgTy = va_arg(Args, Type*)) + std::vector<const Type*> ArgTys; + while (const Type *ArgTy = va_arg(Args, const Type*)) ArgTys.push_back(ArgTy); va_end(Args); diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index 10467a8d900..ac8b76ff1eb 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -325,6 +325,13 @@ FunctionType::FunctionType(const Type *Result, ArrayRef<Type*> Params, NumContainedTys = Params.size() + 1; // + 1 for result type } +// FIXME: Remove this version. +FunctionType *FunctionType::get(const Type *ReturnType, + ArrayRef<const Type*> Params, bool isVarArg) { + return get(ReturnType, ArrayRef<Type*>(const_cast<Type**>(Params.data()), + Params.size()), isVarArg); +} + // FunctionType::get - The factory function for the FunctionType class. FunctionType *FunctionType::get(const Type *ReturnType, ArrayRef<Type*> Params, bool isVarArg) { @@ -350,7 +357,7 @@ FunctionType *FunctionType::get(const Type *ReturnType, FunctionType *FunctionType::get(const Type *Result, bool isVarArg) { - return get(Result, ArrayRef<Type *>(), isVarArg); + return get(Result, ArrayRef<const Type *>(), isVarArg); } @@ -458,15 +465,22 @@ void StructType::setName(StringRef Name) { //===----------------------------------------------------------------------===// // StructType Helper functions. +// FIXME: Remove this version. +StructType *StructType::get(LLVMContext &Context, ArrayRef<const Type*>Elements, + bool isPacked) { + return get(Context, ArrayRef<Type*>(const_cast<Type**>(Elements.data()), + Elements.size()), isPacked); +} + StructType *StructType::get(LLVMContext &Context, bool isPacked) { - return get(Context, llvm::ArrayRef<Type*>(), isPacked); + return get(Context, llvm::ArrayRef<const Type*>(), isPacked); } -StructType *StructType::get(Type *type, ...) { +StructType *StructType::get(const Type *type, ...) { assert(type != 0 && "Cannot create a struct type with no elements with this"); LLVMContext &Ctx = type->getContext(); va_list ap; - SmallVector<llvm::Type*, 8> StructFields; + SmallVector<const llvm::Type*, 8> StructFields; va_start(ap, type); while (type) { StructFields.push_back(type); |