Adjust for new CallInst constructor interface.
authorReid Spencer <rspencer@reidspencer.com>
Thu, 2 Aug 2007 03:30:26 +0000 (03:30 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Thu, 2 Aug 2007 03:30:26 +0000 (03:30 +0000)
This fixes test/Feature/llvm2cpp.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40714 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm2cpp/CppWriter.cpp

index b1ba0013bbe5b3816e103a5d8f0b3779dd7a541e..1cba7578bc8779e210b71aeeedb55104e7dc5458 100644 (file)
@@ -1325,7 +1325,7 @@ CppWriter::printInstruction(const Instruction *I, const std::string& bbname) {
             << (ila->hasSideEffects() ? "true" : "false") << ");";
         nl(Out);
       }
-      if (call->getNumOperands() > 3) {
+      if (call->getNumOperands() > 2) {
         Out << "std::vector<Value*> " << iName << "_params;";
         nl(Out);
         for (unsigned i = 1; i < call->getNumOperands(); ++i) {
@@ -1333,11 +1333,8 @@ CppWriter::printInstruction(const Instruction *I, const std::string& bbname) {
           nl(Out);
         }
         Out << "CallInst* " << iName << " = new CallInst("
-            << opNames[0] << ", &" << iName << "_params[0], " 
-            << call->getNumOperands() - 1 << ", \"";
-      } else if (call->getNumOperands() == 3) {
-        Out << "CallInst* " << iName << " = new CallInst("
-            << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
+            << opNames[0] << ", " << iName << "_params.begin(), "
+            << iName << "_params.end(), \"";
       } else if (call->getNumOperands() == 2) {
         Out << "CallInst* " << iName << " = new CallInst("
             << opNames[0] << ", " << opNames[1] << ", \"";