[cfe-commits] r98833 - /cfe/trunk/lib/CodeGen/CGException.cpp

Benjamin Kramer benny.kra at googlemail.com
Thu Mar 18 09:59:57 PDT 2010


Author: d0k
Date: Thu Mar 18 11:59:57 2010
New Revision: 98833

URL: http://llvm.org/viewvc/llvm-project?rev=98833&view=rev
Log:
Replace some SmallVectors with arrays.

Modified:
    cfe/trunk/lib/CodeGen/CGException.cpp

Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=98833&r1=98832&r2=98833&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Thu Mar 18 11:59:57 2010
@@ -486,8 +486,6 @@
   llvm::Value *Exc = Builder.CreateCall(llvm_eh_exception, "exc");
   llvm::Value *RethrowPtr = CreateTempAlloca(Exc->getType(), "_rethrow");
 
-  llvm::SmallVector<llvm::Value*, 8> Args;
-  Args.clear();
   SelectorArgs.push_back(Exc);
   SelectorArgs.push_back(Personality);
 
@@ -584,12 +582,11 @@
     llvm::Value *Exc = Builder.CreateCall(llvm_eh_exception, "exc");
     // We are required to emit this call to satisfy LLVM, even
     // though we don't use the result.
-    Args.clear();
-    Args.push_back(Exc);
-    Args.push_back(Personality);
-    Args.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext),
-                                          0));
-    Builder.CreateCall(llvm_eh_selector, Args.begin(), Args.end());
+    llvm::Value *Args[] = {
+      Exc, Personality,
+      llvm::ConstantInt::getNullValue(llvm::Type::getInt32Ty(VMContext))
+    };
+    Builder.CreateCall(llvm_eh_selector, &Args[0], llvm::array_endof(Args));
     Builder.CreateStore(Exc, RethrowPtr);
     EmitBranchThroughCleanup(FinallyRethrow);
 
@@ -600,7 +597,7 @@
     llvm::BasicBlock *Cont = createBasicBlock("invoke.cont");
     Builder.CreateInvoke(getEndCatchFn(*this),
                          Cont, TerminateHandler,
-                         Args.begin(), Args.begin());
+                         &Args[0], &Args[0]);
     EmitBlock(Cont);
     if (Info.SwitchBlock)
       EmitBlock(Info.SwitchBlock);
@@ -677,12 +674,8 @@
   // C string type.  Used in lots of places.
   PtrToInt8Ty = llvm::PointerType::getUnqual(Int8Ty);
   llvm::Constant *Null = llvm::ConstantPointerNull::get(PtrToInt8Ty);
-  llvm::SmallVector<llvm::Value*, 8> Args;
-  Args.clear();
-  Args.push_back(Exc);
-  Args.push_back(Personality);
-  Args.push_back(Null);
-  CGF.Builder.CreateCall(llvm_eh_selector, Args.begin(), Args.end());
+  llvm::Value *Args[] = { Exc, Personality, Null };
+  CGF.Builder.CreateCall(llvm_eh_selector, &Args[0], llvm::array_endof(Args));
 
   CGF.EmitBlock(CleanupEntryBB);
 
@@ -731,12 +724,11 @@
   llvm::Value *Exc = Builder.CreateCall(llvm_eh_exception, "exc");
   // We are required to emit this call to satisfy LLVM, even
   // though we don't use the result.
-  llvm::SmallVector<llvm::Value*, 8> Args;
-  Args.push_back(Exc);
-  Args.push_back(Personality);
-  Args.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext),
-                                        1));
-  Builder.CreateCall(llvm_eh_selector, Args.begin(), Args.end());
+  llvm::Value *Args[] = {
+    Exc, Personality,
+    llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 1)
+  };
+  Builder.CreateCall(llvm_eh_selector, &Args[0], llvm::array_endof(Args));
   llvm::CallInst *TerminateCall =
     Builder.CreateCall(getTerminateFn(*this));
   TerminateCall->setDoesNotReturn();





More information about the cfe-commits mailing list