]> granicus.if.org Git - clang/commitdiff
Eliminate temporary argument vectors.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 May 2011 14:26:31 +0000 (14:26 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 May 2011 14:26:31 +0000 (14:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132260 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGDeclCXX.cpp
lib/CodeGen/CGExprScalar.cpp
lib/CodeGen/CGObjCGNU.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/ItaniumCXXABI.cpp

index 2f4104da937478c58607bae504020372e018449c..14bebaf3c1cb543e61455f193f278d5c1e768f47 100644 (file)
@@ -164,9 +164,8 @@ static Value *EmitFAbs(CodeGenFunction &CGF, Value *V, QualType ValTy) {
   }
   
   // The prototype is something that takes and returns whatever V's type is.
-  std::vector<const llvm::Type*> Args;
-  Args.push_back(V->getType());
-  llvm::FunctionType *FT = llvm::FunctionType::get(V->getType(), Args, false);
+  llvm::FunctionType *FT = llvm::FunctionType::get(V->getType(), V->getType(),
+                                                   false);
   llvm::Value *Fn = CGF.CGM.CreateRuntimeFunction(FT, FnName);
 
   return CGF.Builder.CreateCall(Fn, V, "abs");
index a24203c44982a1b3c9a7ea499d3fd8a99fbabebb..178badd44d816632098f172d30b1ac255590c8bf 100644 (file)
@@ -117,19 +117,13 @@ CodeGenFunction::EmitCXXGlobalDtorRegistration(llvm::Constant *DtorFn,
     return;
   }
 
-  std::vector<const llvm::Type *> Params;
-  Params.push_back(Int8PtrTy);
-
   // Get the destructor function type
   const llvm::Type *DtorFnTy =
     llvm::FunctionType::get(llvm::Type::getVoidTy(getLLVMContext()),
-                            Params, false);
+                            Int8PtrTy, false);
   DtorFnTy = llvm::PointerType::getUnqual(DtorFnTy);
 
-  Params.clear();
-  Params.push_back(DtorFnTy);
-  Params.push_back(Int8PtrTy);
-  Params.push_back(Int8PtrTy);
+  const llvm::Type *Params[] = { DtorFnTy, Int8PtrTy, Int8PtrTy };
 
   // Get the __cxa_atexit function type
   // extern "C" int __cxa_atexit ( void (*f)(void *), void *p, void *d );
index be9089a9c5258322f1cd2e84b517d06fa655b1de..b1d457589d82c7d7f794aa99fbfedb50d1a9ce13 100644 (file)
@@ -1788,9 +1788,7 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) {
 
   // Get the overflow handler.
   const llvm::Type *Int8Ty = llvm::Type::getInt8Ty(VMContext);
-  std::vector<const llvm::Type*> argTypes;
-  argTypes.push_back(CGF.Int64Ty); argTypes.push_back(CGF.Int64Ty);
-  argTypes.push_back(Int8Ty); argTypes.push_back(Int8Ty);
+  const llvm::Type *argTypes[] = { CGF.Int64Ty, CGF.Int64Ty, Int8Ty, Int8Ty };
   llvm::FunctionType *handlerTy =
       llvm::FunctionType::get(CGF.Int64Ty, argTypes, true);
   llvm::Value *handler = CGF.CGM.CreateRuntimeFunction(handlerTy, *handlerName);
index 9c0ecc751dc53e0bc861c42360467b8efda22271..58bcf6f40ad65289c0f104b066cbd296fdd14556 100644 (file)
@@ -736,9 +736,7 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
       PtrDiffTy, BoolTy, BoolTy, NULL);
 
   // IMP type
-  std::vector<const llvm::Type*> IMPArgs;
-  IMPArgs.push_back(IdTy);
-  IMPArgs.push_back(SelectorTy);
+  const llvm::Type *IMPArgs[] = { IdTy, SelectorTy };
   IMPTy = llvm::PointerType::getUnqual(llvm::FunctionType::get(IdTy, IMPArgs,
               true));
 
@@ -786,11 +784,8 @@ llvm::Value *CGObjCGNU::GetClass(CGBuilderTy &Builder,
   EmitClassRef(OID->getNameAsString());
   ClassName = Builder.CreateStructGEP(ClassName, 0);
 
-  std::vector<const llvm::Type*> Params(1, PtrToInt8Ty);
   llvm::Constant *ClassLookupFn =
-    CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy,
-                                                      Params,
-                                                      true),
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, PtrToInt8Ty, true),
                               "objc_lookup_class");
   return Builder.CreateCall(ClassLookupFn, ClassName);
 }
@@ -983,14 +978,12 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF,
   llvm::Value *ReceiverClass = 0;
   if (isCategoryImpl) {
     llvm::Constant *classLookupFunction = 0;
-    std::vector<const llvm::Type*> Params;
-    Params.push_back(PtrTy);
     if (IsClassMessage)  {
       classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
-            IdTy, Params, true), "objc_get_meta_class");
+            IdTy, PtrTy, true), "objc_get_meta_class");
     } else {
       classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
-            IdTy, Params, true), "objc_get_class");
+            IdTy, PtrTy, true), "objc_get_class");
     }
     ReceiverClass = Builder.CreateCall(classLookupFunction,
         MakeConstantString(Class->getNameAsString()));
@@ -2183,10 +2176,10 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
   CGBuilderTy Builder(VMContext);
   Builder.SetInsertPoint(EntryBB);
 
-  std::vector<const llvm::Type*> Params(1,
-      llvm::PointerType::getUnqual(ModuleTy));
-  llvm::Value *Register = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
-        llvm::Type::getVoidTy(VMContext), Params, true), "__objc_exec_class");
+  llvm::FunctionType *FT =
+    llvm::FunctionType::get(Builder.getVoidTy(),
+                            llvm::PointerType::getUnqual(ModuleTy), true);
+  llvm::Value *Register = CGM.CreateRuntimeFunction(FT, "__objc_exec_class");
   Builder.CreateCall(Register, Module);
   Builder.CreateRetVoid();
 
index 28a4fa4baecd9c42984b547c52c11a5f5a33e56a..d42057aba033dbf2a7bfb74ab43def8a59be1ae9 100644 (file)
@@ -205,16 +205,12 @@ bool CodeGenFunction::ShouldInstrumentFunction() {
 /// instrumentation function with the current function and the call site, if
 /// function instrumentation is enabled.
 void CodeGenFunction::EmitFunctionInstrumentation(const char *Fn) {
-  const llvm::PointerType *PointerTy;
-  const llvm::FunctionType *FunctionTy;
-  std::vector<const llvm::Type*> ProfileFuncArgs;
-
   // void __cyg_profile_func_{enter,exit} (void *this_fn, void *call_site);
-  PointerTy = Int8PtrTy;
-  ProfileFuncArgs.push_back(PointerTy);
-  ProfileFuncArgs.push_back(PointerTy);
-  FunctionTy = llvm::FunctionType::get(llvm::Type::getVoidTy(getLLVMContext()),
-                                       ProfileFuncArgs, false);
+  const llvm::PointerType *PointerTy = Int8PtrTy;
+  const llvm::Type *ProfileFuncArgs[] = { PointerTy, PointerTy };
+  const llvm::FunctionType *FunctionTy =
+    llvm::FunctionType::get(llvm::Type::getVoidTy(getLLVMContext()),
+                            ProfileFuncArgs, false);
 
   llvm::Constant *F = CGM.CreateRuntimeFunction(FunctionTy, Fn);
   llvm::CallInst *CallSite = Builder.CreateCall(
index 33abf3a4aaf7ff25ad203cd6a27470b9c3fb3ca9..12ef9bd030bdd12411bc4eda9bb090a21817a9a8 100644 (file)
@@ -1007,11 +1007,9 @@ void ARMCXXABI::ReadArrayCookie(CodeGenFunction &CGF,
 static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM,
                                          const llvm::PointerType *GuardPtrTy) {
   // int __cxa_guard_acquire(__guard *guard_object);
-  
-  std::vector<const llvm::Type*> Args(1, GuardPtrTy);  
   const llvm::FunctionType *FTy =
     llvm::FunctionType::get(CGM.getTypes().ConvertType(CGM.getContext().IntTy),
-                            Args, /*isVarArg=*/false);
+                            GuardPtrTy, /*isVarArg=*/false);
   
   return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_acquire");
 }
@@ -1019,12 +1017,9 @@ static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM,
 static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM,
                                          const llvm::PointerType *GuardPtrTy) {
   // void __cxa_guard_release(__guard *guard_object);
-  
-  std::vector<const llvm::Type*> Args(1, GuardPtrTy);
-  
   const llvm::FunctionType *FTy =
     llvm::FunctionType::get(llvm::Type::getVoidTy(CGM.getLLVMContext()),
-                            Args, /*isVarArg=*/false);
+                            GuardPtrTy, /*isVarArg=*/false);
   
   return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_release");
 }
@@ -1032,12 +1027,9 @@ static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM,
 static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM,
                                        const llvm::PointerType *GuardPtrTy) {
   // void __cxa_guard_abort(__guard *guard_object);
-  
-  std::vector<const llvm::Type*> Args(1, GuardPtrTy);
-  
   const llvm::FunctionType *FTy =
     llvm::FunctionType::get(llvm::Type::getVoidTy(CGM.getLLVMContext()),
-                            Args, /*isVarArg=*/false);
+                            GuardPtrTy, /*isVarArg=*/false);
   
   return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_abort");
 }