diff options
author | Chris Lattner <sabre@nondot.org> | 2011-06-18 22:48:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-06-18 22:48:56 +0000 |
commit | b2318662b6d2e6d9ea9917fd280dde0ba9a938ad (patch) | |
tree | 68fa7b164e186267795a98ba805b9ee2c7adcf40 /lib | |
parent | ea049181a020b233cfd8a33583e2784d590e1dcb (diff) | |
download | llvm-b2318662b6d2e6d9ea9917fd280dde0ba9a938ad.tar.gz llvm-b2318662b6d2e6d9ea9917fd280dde0ba9a938ad.tar.bz2 llvm-b2318662b6d2e6d9ea9917fd280dde0ba9a938ad.tar.xz |
fix the varargs version of StructType::get to not require an LLVMContext, making usage
much cleaner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SjLjEHPrepare.cpp | 3 | ||||
-rw-r--r-- | lib/Transforms/Instrumentation/PathProfiling.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/Type.cpp | 8 |
4 files changed, 9 insertions, 8 deletions
diff --git a/lib/CodeGen/SjLjEHPrepare.cpp b/lib/CodeGen/SjLjEHPrepare.cpp index 92970e496c..c2565afe01 100644 --- a/lib/CodeGen/SjLjEHPrepare.cpp +++ b/lib/CodeGen/SjLjEHPrepare.cpp @@ -91,8 +91,7 @@ bool SjLjEHPass::doInitialization(Module &M) { Type::getInt8PtrTy(M.getContext()); const Type *Int32Ty = Type::getInt32Ty(M.getContext()); FunctionContextTy = - StructType::get(M.getContext(), - VoidPtrTy, // __prev + StructType::get(VoidPtrTy, // __prev Int32Ty, // call_site ArrayType::get(Int32Ty, 4), // __data VoidPtrTy, // __personality diff --git a/lib/Transforms/Instrumentation/PathProfiling.cpp b/lib/Transforms/Instrumentation/PathProfiling.cpp index 182a43d396..1e5e3f6529 100644 --- a/lib/Transforms/Instrumentation/PathProfiling.cpp +++ b/lib/Transforms/Instrumentation/PathProfiling.cpp @@ -376,7 +376,7 @@ namespace llvm { public: static const StructType *get(LLVMContext& C) { return( StructType::get( - C, TypeBuilder<types::i<32>, xcompile>::get(C), // type + TypeBuilder<types::i<32>, xcompile>::get(C), // type TypeBuilder<types::i<32>, xcompile>::get(C), // array size TypeBuilder<types::i<8>*, xcompile>::get(C), // array/hash ptr NULL)); diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 15d7793d58..0cf6c4ed82 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1537,8 +1537,8 @@ Constant *ConstantExpr::getSizeOf(const Type* Ty) { Constant *ConstantExpr::getAlignOf(const Type* Ty) { // alignof is implemented as: (i64) gep ({i1,Ty}*)null, 0, 1 // Note that a non-inbounds gep is used, as null isn't within any object. - const Type *AligningTy = StructType::get(Ty->getContext(), - Type::getInt1Ty(Ty->getContext()), Ty, NULL); + const Type *AligningTy = + StructType::get(Type::getInt1Ty(Ty->getContext()), Ty, NULL); Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo()); Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0); Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index ebe431bdc2..9299070920 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -939,15 +939,17 @@ StructType *StructType::get(LLVMContext &Context, return ST; } -StructType *StructType::get(LLVMContext &Context, const 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; - std::vector<const llvm::Type*> StructFields; + SmallVector<const llvm::Type*, 8> StructFields; va_start(ap, type); while (type) { StructFields.push_back(type); type = va_arg(ap, llvm::Type*); } - return llvm::StructType::get(Context, StructFields); + return llvm::StructType::get(Ctx, StructFields); } bool StructType::isValidElementType(const Type *ElemTy) { |