diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-01 04:13:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-01 04:13:31 +0000 |
commit | 3fd51c08231f27cb280cab51d72e8b5f6f096e32 (patch) | |
tree | f66dcf7ae670ad83fafd93662fe76538a2203c35 /lib/Transforms | |
parent | d617fe7ba250568ad8b102268c316c519ed67a10 (diff) | |
download | external_llvm-3fd51c08231f27cb280cab51d72e8b5f6f096e32.zip external_llvm-3fd51c08231f27cb280cab51d72e8b5f6f096e32.tar.gz external_llvm-3fd51c08231f27cb280cab51d72e8b5f6f096e32.tar.bz2 |
improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least). Patch by Jay Foad!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 3 | ||||
-rw-r--r-- | lib/Transforms/IPO/RaiseAllocations.cpp | 9 | ||||
-rw-r--r-- | lib/Transforms/Utils/LowerAllocations.cpp | 2 |
3 files changed, 5 insertions, 9 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index cbf3a1d..7fe097c 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -1928,8 +1928,7 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL, if (Ctors[i]) { CSVals[1] = Ctors[i]; } else { - const Type *FTy = FunctionType::get(Type::VoidTy, - std::vector<const Type*>(), false); + const Type *FTy = FunctionType::get(Type::VoidTy, false); const PointerType *PFTy = PointerType::getUnqual(FTy); CSVals[1] = Constant::getNullValue(PFTy); CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647); diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index 8c97b5d..9900368 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -92,8 +92,7 @@ void RaiseAllocations::doInitialization(Module &M) { // i8*(...) * malloc // This handles the common declaration of: 'void *malloc();' const FunctionType *Malloc3Type = - FunctionType::get(PointerType::getUnqual(Type::Int8Ty), - std::vector<const Type*>(), true); + FunctionType::get(PointerType::getUnqual(Type::Int8Ty), true); if (TyWeHave != Malloc3Type) // Give up MallocFunc = 0; @@ -113,14 +112,12 @@ void RaiseAllocations::doInitialization(Module &M) { // Check to see if the prototype was forgotten, giving us // void (...) * free // This handles the common forward declaration of: 'void free();' - const FunctionType* Free2Type = FunctionType::get(Type::VoidTy, - std::vector<const Type*>(),true); + const FunctionType* Free2Type = FunctionType::get(Type::VoidTy, true); if (TyWeHave != Free2Type) { // One last try, check to see if we can find free as // int (...)* free. This handles the case where NOTHING was declared. - const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty, - std::vector<const Type*>(),true); + const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty, true); if (TyWeHave != Free3Type) { // Give up. diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 9af47f5..74e7028 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -89,7 +89,7 @@ bool LowerAllocations::doInitialization(Module &M) { const Type *BPTy = PointerType::getUnqual(Type::Int8Ty); // Prototype malloc as "char* malloc(...)", because we don't know in // doInitialization whether size_t is int or long. - FunctionType *FT = FunctionType::get(BPTy, std::vector<const Type*>(), true); + FunctionType *FT = FunctionType::get(BPTy, true); MallocFunc = M.getOrInsertFunction("malloc", FT); FreeFunc = M.getOrInsertFunction("free" , Type::VoidTy, BPTy, (Type *)0); return true; |