New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector.

Updates to all clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40660 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp
index aaf9986..90642f1 100644
--- a/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/lib/Transforms/Utils/CodeExtractor.cpp
@@ -393,7 +393,7 @@
   }
 
   // Emit the call to the function
-  CallInst *call = new CallInst(newFunction, &params[0], params.size(),
+  CallInst *call = new CallInst(newFunction, params.begin(), params.end(),
                                 NumExitBlocks > 1 ? "targetBlock" : "");
   codeReplacer->getInstList().push_back(call);
 
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index d72c018..551ca7f 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -212,7 +212,7 @@
       std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end());
       // Insert a normal call instruction...
       CallInst *NewCall = new CallInst(II->getCalledValue(),
-                                       &CallArgs[0], CallArgs.size(), "", II);
+                                       CallArgs.begin(), CallArgs.end(), "", II);
       NewCall->takeName(II);
       NewCall->setCallingConv(II->getCallingConv());
       II->replaceAllUsesWith(NewCall);
@@ -269,7 +269,7 @@
   // Insert a normal call instruction.
   std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end());
   CallInst *NewCall = new CallInst(II->getCalledValue(),
-                                   &CallArgs[0], CallArgs.size(), "",
+                                   CallArgs.begin(), CallArgs.end(), "",
                                    II);
   NewCall->takeName(II);
   NewCall->setCallingConv(II->getCallingConv());
@@ -542,7 +542,7 @@
   Idx.push_back(ConstantInt::get(Type::Int32Ty, 0));
   Idx[0] = new GetElementPtrInst(BufPtr, &Idx[0], 2, "JmpBuf", UnwindBlock);
   Idx[1] = ConstantInt::get(Type::Int32Ty, 1);
-  new CallInst(LongJmpFn, &Idx[0], Idx.size(), "", UnwindBlock);
+  new CallInst(LongJmpFn, Idx.begin(), Idx.end(), "", UnwindBlock);
   new UnreachableInst(UnwindBlock);
   
   // Set up the term block ("throw without a catch").
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 6c34d02..470daf3 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1374,7 +1374,7 @@
           // Insert the call now...
           SmallVector<Value*,8> Args(II->op_begin()+3, II->op_end());
           CallInst *CI = new CallInst(II->getCalledValue(),
-                                      &Args[0], Args.size(), II->getName(), BI);
+                                      Args.begin(), Args.end(), II->getName(), BI);
           CI->setCallingConv(II->getCallingConv());
           // If the invoke produced a value, the Call now does instead
           II->replaceAllUsesWith(CI);
@@ -1748,7 +1748,7 @@
             // Insert the call now...
             SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
             CallInst *CI = new CallInst(II->getCalledValue(),
-                                        &Args[0], Args.size(),
+                                        Args.begin(), Args.end(),
                                         II->getName(), BI);
             CI->setCallingConv(II->getCallingConv());
             // If the invoke produced a value, the Call does now instead.