diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-07-11 09:56:20 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-07-11 09:56:20 +0000 |
commit | 7c57be3e2b6f3001cdb1e78b921f9e7ccc84f32c (patch) | |
tree | 78c4de58c0ef5727e68c34792646f069b2fde448 | |
parent | dd8fc04e9bf9b5288bb73bcd0d2a1e079b5a0750 (diff) | |
download | bcm5719-llvm-7c57be3e2b6f3001cdb1e78b921f9e7ccc84f32c.tar.gz bcm5719-llvm-7c57be3e2b6f3001cdb1e78b921f9e7ccc84f32c.zip |
De-constify Types in StructType::get() and TargetData::getIntPtrType().
llvm-svn: 134893
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 18 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 6 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 6 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 22 | ||||
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.h | 6 | ||||
-rw-r--r-- | llvm/include/llvm/DerivedTypes.h | 7 | ||||
-rw-r--r-- | llvm/include/llvm/Target/TargetData.h | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMGlobalMerge.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/TargetData.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/CodeExtractor.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Core.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Type.cpp | 13 | ||||
-rw-r--r-- | llvm/tools/bugpoint/ExtractFunction.cpp | 2 | ||||
-rw-r--r-- | llvm/unittests/Support/TypeBuilderTest.cpp | 4 |
20 files changed, 51 insertions, 65 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 020cbdf60e1..f529b583af4 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -164,11 +164,11 @@ namespace { CharUnits Alignment; CharUnits Size; const BlockDecl::Capture *Capture; // null for 'this' - const llvm::Type *Type; + llvm::Type *Type; BlockLayoutChunk(CharUnits align, CharUnits size, const BlockDecl::Capture *capture, - const llvm::Type *type) + llvm::Type *type) : Alignment(align), Size(size), Capture(capture), Type(type) {} /// Tell the block info that this chunk has the given field index. @@ -243,7 +243,7 @@ static CharUnits getLowBit(CharUnits v) { } static void initializeForBlockHeader(CodeGenModule &CGM, CGBlockInfo &info, - llvm::SmallVectorImpl<const llvm::Type*> &elementTypes) { + llvm::SmallVectorImpl<llvm::Type*> &elementTypes) { ASTContext &C = CGM.getContext(); // The header is basically a 'struct { void *; int; int; void *; void *; }'. @@ -263,8 +263,8 @@ static void initializeForBlockHeader(CodeGenModule &CGM, CGBlockInfo &info, info.BlockSize = headerSize; assert(elementTypes.empty()); - const llvm::Type *i8p = CGM.getTypes().ConvertType(C.VoidPtrTy); - const llvm::Type *intTy = CGM.getTypes().ConvertType(C.IntTy); + llvm::Type *i8p = CGM.getTypes().ConvertType(C.VoidPtrTy); + llvm::Type *intTy = CGM.getTypes().ConvertType(C.IntTy); elementTypes.push_back(i8p); elementTypes.push_back(intTy); elementTypes.push_back(intTy); @@ -280,7 +280,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { ASTContext &C = CGM.getContext(); const BlockDecl *block = info.getBlockDecl(); - llvm::SmallVector<const llvm::Type*, 8> elementTypes; + llvm::SmallVector<llvm::Type*, 8> elementTypes; initializeForBlockHeader(CGM, info, elementTypes); if (!block->hasCaptures()) { @@ -308,7 +308,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { else thisType = cast<CXXMethodDecl>(DC)->getThisType(C); - const llvm::Type *llvmType = CGM.getTypes().ConvertType(thisType); + llvm::Type *llvmType = CGM.getTypes().ConvertType(thisType); std::pair<CharUnits,CharUnits> tinfo = CGM.getContext().getTypeInfoInChars(thisType); maxFieldAlign = std::max(maxFieldAlign, tinfo.second); @@ -328,7 +328,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // Just use void* instead of a pointer to the byref type. QualType byRefPtrTy = C.VoidPtrTy; - const llvm::Type *llvmType = CGM.getTypes().ConvertType(byRefPtrTy); + llvm::Type *llvmType = CGM.getTypes().ConvertType(byRefPtrTy); std::pair<CharUnits,CharUnits> tinfo = CGM.getContext().getTypeInfoInChars(byRefPtrTy); maxFieldAlign = std::max(maxFieldAlign, tinfo.second); @@ -384,7 +384,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { CharUnits align = C.getDeclAlign(variable); maxFieldAlign = std::max(maxFieldAlign, align); - const llvm::Type *llvmType = + llvm::Type *llvmType = CGM.getTypes().ConvertTypeForMem(variable->getType()); layout.push_back(BlockLayoutChunk(align, size, &*ci, llvmType)); diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 42e1450125b..8f27a514740 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -533,7 +533,7 @@ public: // Build a struct with the union sub-element as the first member, // and padded to the appropriate size std::vector<llvm::Constant*> Elts; - std::vector<const llvm::Type*> Types; + std::vector<llvm::Type*> Types; Elts.push_back(C); Types.push_back(C->getType()); unsigned CurSize = CGM.getTargetData().getTypeAllocSize(C->getType()); @@ -541,7 +541,7 @@ public: assert(CurSize <= TotalSize && "Union size mismatch!"); if (unsigned NumPadBytes = TotalSize - CurSize) { - const llvm::Type *Ty = llvm::Type::getInt8Ty(VMContext); + llvm::Type *Ty = llvm::Type::getInt8Ty(VMContext); if (NumPadBytes > 1) Ty = llvm::ArrayType::get(Ty, NumPadBytes); @@ -711,7 +711,7 @@ public: if (RewriteType) { // FIXME: Try to avoid packing the array - std::vector<const llvm::Type*> Types; + std::vector<llvm::Type*> Types; for (unsigned i = 0; i < Elts.size(); ++i) Types.push_back(Elts[i]->getType()); const llvm::StructType *SType = llvm::StructType::get(AType->getContext(), diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index f4571eeee14..dc61a9c54fe 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -151,7 +151,7 @@ protected: /// LLVM type for C long type. The runtime uses this in a lot of places where /// it should be using intptr_t, but we can't fix this without breaking /// compatibility with GCC... - const llvm::IntegerType *LongTy; + llvm::IntegerType *LongTy; /// LLVM type for C size_t. Used in various runtime data structures. const llvm::IntegerType *SizeTy; /// LLVM type for C ptrdiff_t. Mainly used in property accessor functions. @@ -2036,7 +2036,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { const llvm::StructType *SelStructTy = dyn_cast<llvm::StructType>( SelectorTy->getElementType()); - const llvm::Type *SelStructPtrTy = SelectorTy; + llvm::Type *SelStructPtrTy = SelectorTy; if (SelStructTy == 0) { SelStructTy = llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, NULL); SelStructPtrTy = llvm::PointerType::getUnqual(SelStructTy); diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 20979475373..443d8776bfd 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -1408,8 +1408,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { std::vector<LValue> ResultRegDests; std::vector<QualType> ResultRegQualTys; - std::vector<const llvm::Type *> ResultRegTypes; - std::vector<const llvm::Type *> ResultTruncRegTypes; + std::vector<llvm::Type *> ResultRegTypes; + std::vector<llvm::Type *> ResultTruncRegTypes; std::vector<llvm::Type*> ArgTypes; std::vector<llvm::Value*> Args; @@ -1465,7 +1465,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { ResultRegTypes.back() = ConvertType(InputTy); } } - if (const llvm::Type* AdjTy = + if (llvm::Type* AdjTy = getTargetHooks().adjustInlineAsmType(*this, OutputConstraint, ResultRegTypes.back())) ResultRegTypes.back() = AdjTy; diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 967cd709c89..84b9fba5fd4 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -279,8 +279,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { break; } case Type::Complex: { - const llvm::Type *EltTy = - ConvertType(cast<ComplexType>(Ty)->getElementType()); + llvm::Type *EltTy = ConvertType(cast<ComplexType>(Ty)->getElementType()); ResultType = llvm::StructType::get(EltTy, EltTy, NULL); break; } diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index ae7de5d19cf..f7cdea5efc6 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -356,9 +356,9 @@ bool UseX86_MMXType(const llvm::Type *IRType) { IRType->getScalarSizeInBits() != 64; } -static const llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) { +static llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF, + llvm::StringRef Constraint, + llvm::Type* Ty) { if ((Constraint == "y" || Constraint == "&y") && Ty->isVectorTy()) return llvm::Type::getX86_MMXTy(CGF.getLLVMContext()); return Ty; @@ -427,9 +427,9 @@ public: bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const; - const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) const { + llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, + llvm::StringRef Constraint, + llvm::Type* Ty) const { return X86AdjustInlineAsmType(CGF, Constraint, Ty); } @@ -926,9 +926,9 @@ public: return false; } - const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) const { + llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, + llvm::StringRef Constraint, + llvm::Type* Ty) const { return X86AdjustInlineAsmType(CGF, Constraint, Ty); } @@ -1572,7 +1572,7 @@ GetINTEGERTypeAtOffset(llvm::Type *IRType, unsigned IROffset, /// a by-value argument should be passed as i32* and the high part as float, /// return {i32*, float}. static llvm::Type * -GetX86_64ByValArgumentPair(const llvm::Type *Lo, const llvm::Type *Hi, +GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi, const llvm::TargetData &TD) { // In order to correctly satisfy the ABI, we need to the high part to start // at offset 8. If the high and low parts we inferred are both 4-byte types @@ -2056,7 +2056,7 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, // area, we need to collect the two eightbytes together. llvm::Value *RegAddrLo = CGF.Builder.CreateGEP(RegAddr, fp_offset); llvm::Value *RegAddrHi = CGF.Builder.CreateConstGEP1_32(RegAddrLo, 16); - const llvm::Type *DoubleTy = llvm::Type::getDoubleTy(VMContext); + llvm::Type *DoubleTy = llvm::Type::getDoubleTy(VMContext); const llvm::Type *DblPtrTy = llvm::PointerType::getUnqual(DoubleTy); const llvm::StructType *ST = llvm::StructType::get(DoubleTy, diff --git a/clang/lib/CodeGen/TargetInfo.h b/clang/lib/CodeGen/TargetInfo.h index dbb09b1614d..d5e8884cdff 100644 --- a/clang/lib/CodeGen/TargetInfo.h +++ b/clang/lib/CodeGen/TargetInfo.h @@ -106,9 +106,9 @@ namespace clang { return Address; } - virtual const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) const { + virtual llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, + llvm::StringRef Constraint, + llvm::Type* Ty) const { return Ty; } diff --git a/llvm/include/llvm/DerivedTypes.h b/llvm/include/llvm/DerivedTypes.h index fa16094ec8c..0f1e99f1349 100644 --- a/llvm/include/llvm/DerivedTypes.h +++ b/llvm/include/llvm/DerivedTypes.h @@ -204,11 +204,6 @@ public: /// StructType::get - This static method is the primary way to create a /// StructType. - /// - /// FIXME: Remove the 'const Type*' version of this when types are pervasively - /// de-constified. - static StructType *get(LLVMContext &Context, ArrayRef<const Type*> Elements, - bool isPacked = false); static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements, bool isPacked = false); @@ -220,7 +215,7 @@ public: /// structure types by specifying the elements as arguments. Note that this /// method always returns a non-packed struct, and requires at least one /// element type. - static StructType *get(const Type *elt1, ...) END_WITH_NULL; + static StructType *get(Type *elt1, ...) END_WITH_NULL; bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; } diff --git a/llvm/include/llvm/Target/TargetData.h b/llvm/include/llvm/Target/TargetData.h index 32e3e2b0b61..10252865c96 100644 --- a/llvm/include/llvm/Target/TargetData.h +++ b/llvm/include/llvm/Target/TargetData.h @@ -259,7 +259,7 @@ public: /// getIntPtrType - Return an unsigned integer type that is the same size or /// greater to the host pointer size. /// - const IntegerType *getIntPtrType(LLVMContext &C) const; + IntegerType *getIntPtrType(LLVMContext &C) const; /// getIndexedOffset - return the offset from the beginning of the type for /// the specified indices. This is used to implement getelementptr. diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index c2565afe016..65a33da93af 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -87,9 +87,8 @@ FunctionPass *llvm::createSjLjEHPass(const TargetLowering *TLI) { bool SjLjEHPass::doInitialization(Module &M) { // Build the function context structure. // builtin_setjmp uses a five word jbuf - const Type *VoidPtrTy = - Type::getInt8PtrTy(M.getContext()); - const Type *Int32Ty = Type::getInt32Ty(M.getContext()); + Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext()); + Type *Int32Ty = Type::getInt32Ty(M.getContext()); FunctionContextTy = StructType::get(VoidPtrTy, // __prev Int32Ty, // call_site diff --git a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp b/llvm/lib/Target/ARM/ARMGlobalMerge.cpp index f8993792bc6..8d77b2d8383 100644 --- a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp +++ b/llvm/lib/Target/ARM/ARMGlobalMerge.cpp @@ -128,10 +128,10 @@ bool ARMGlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals, for (size_t i = 0, e = Globals.size(); i != e; ) { size_t j = 0; uint64_t MergedSize = 0; - std::vector<const Type*> Tys; + std::vector<Type*> Tys; std::vector<Constant*> Inits; for (j = i; j != e; ++j) { - const Type *Ty = Globals[j]->getType()->getElementType(); + Type *Ty = Globals[j]->getType()->getElementType(); MergedSize += TD->getTypeAllocSize(Ty); if (MergedSize > MaxOffset) { break; diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp index 6309a1572c5..b2c4b21f680 100644 --- a/llvm/lib/Target/TargetData.cpp +++ b/llvm/lib/Target/TargetData.cpp @@ -535,7 +535,7 @@ unsigned TargetData::getPreferredTypeAlignmentShift(const Type *Ty) const { /// getIntPtrType - Return an unsigned integer type that is the same size or /// greater to the host pointer size. -const IntegerType *TargetData::getIntPtrType(LLVMContext &C) const { +IntegerType *TargetData::getIntPtrType(LLVMContext &C) const { return IntegerType::get(C, getPointerSizeInBits()); } diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 7eb5a487af8..bbb386c0125 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -659,13 +659,13 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) { // Find out the new return value. - const Type *RetTy = FTy->getReturnType(); + Type *RetTy = FTy->getReturnType(); const Type *NRetTy = NULL; unsigned RetCount = NumRetVals(F); // -1 means unused, other numbers are the new index SmallVector<int, 5> NewRetIdxs(RetCount, -1); - std::vector<const Type*> RetTypes; + std::vector<Type*> RetTypes; if (RetTy->isVoidTy()) { NRetTy = RetTy; } else { diff --git a/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp index 4224ee303f0..327e423839f 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp +++ b/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp @@ -134,7 +134,7 @@ void llvm::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum, void llvm::InsertProfilingShutdownCall(Function *Callee, Module *Mod) { // llvm.global_dtors is an array of type { i32, void ()* }. Prepare those // types. - const Type *GlobalDtorElems[2] = { + Type *GlobalDtorElems[2] = { Type::getInt32Ty(Mod->getContext()), FunctionType::get(Type::getVoidTy(Mod->getContext()), false)->getPointerTo() }; diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index fa6641fae51..9a2e53fd518 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -403,7 +403,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, AllocaInst *Struct = 0; if (AggregateArgs && (inputs.size() + outputs.size() > 0)) { - std::vector<const Type*> ArgTypes; + std::vector<Type*> ArgTypes; for (Values::iterator v = StructValues.begin(), ve = StructValues.end(); v != ve; ++v) ArgTypes.push_back((*v)->getType()); diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 57498b48592..1529c4ad481 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<const Type*, 16> EltTypes; + SmallVector<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 07caefa1ec4..15d27233f22 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -290,7 +290,7 @@ void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest) { LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed) { - std::vector<const Type*> Tys; + std::vector<Type*> Tys; for (LLVMTypeRef *I = ElementTypes, *E = ElementTypes + ElementCount; I != E; ++I) Tys.push_back(unwrap(*I)); diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index 40d232a619f..10467a8d900 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -458,22 +458,15 @@ 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<const Type*>(), isPacked); + return get(Context, llvm::ArrayRef<Type*>(), isPacked); } -StructType *StructType::get(const Type *type, ...) { +StructType *StructType::get(Type *type, ...) { assert(type != 0 && "Cannot create a struct type with no elements with this"); LLVMContext &Ctx = type->getContext(); va_list ap; - SmallVector<const llvm::Type*, 8> StructFields; + SmallVector<llvm::Type*, 8> StructFields; va_start(ap, type); while (type) { StructFields.push_back(type); diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp index 7ed15245c19..9941add52e2 100644 --- a/llvm/tools/bugpoint/ExtractFunction.cpp +++ b/llvm/tools/bugpoint/ExtractFunction.cpp @@ -173,7 +173,7 @@ void llvm::DeleteFunctionBody(Function *F) { static Constant *GetTorInit(std::vector<std::pair<Function*, int> > &TorList) { assert(!TorList.empty() && "Don't create empty tor list!"); std::vector<Constant*> ArrayElts; - const Type *Int32Ty = Type::getInt32Ty(TorList[0].first->getContext()); + Type *Int32Ty = Type::getInt32Ty(TorList[0].first->getContext()); const StructType *STy = StructType::get(Int32Ty, TorList[0].first->getType(), NULL); diff --git a/llvm/unittests/Support/TypeBuilderTest.cpp b/llvm/unittests/Support/TypeBuilderTest.cpp index 52b51b38757..06091784cf0 100644 --- a/llvm/unittests/Support/TypeBuilderTest.cpp +++ b/llvm/unittests/Support/TypeBuilderTest.cpp @@ -187,7 +187,7 @@ public: static const StructType *get(LLVMContext &Context) { // Using the static result variable ensures that the type is // only looked up once. - std::vector<const Type*> st; + std::vector<Type*> st; st.push_back(TypeBuilder<int, cross>::get(Context)); st.push_back(TypeBuilder<int*, cross>::get(Context)); st.push_back(TypeBuilder<void*[], cross>::get(Context)); @@ -210,7 +210,7 @@ public: static const StructType *get(LLVMContext &Context) { // Using the static result variable ensures that the type is // only looked up once. - std::vector<const Type*> st; + std::vector<Type*> st; st.push_back(TypeBuilder<types::i<32>, cross>::get(Context)); st.push_back(TypeBuilder<types::i<32>*, cross>::get(Context)); st.push_back(TypeBuilder<types::i<8>*[], cross>::get(Context)); |