Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41697 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y
index 5893fcd..9cc1af2 100644
--- a/tools/llvm-upgrade/UpgradeParser.y
+++ b/tools/llvm-upgrade/UpgradeParser.y
@@ -1533,8 +1533,8 @@
}
}
Result.push_back(Index);
- Ty = GetElementPtrInst::getIndexedType(PTy, (Value**)&Result[0],
- Result.size(),true);
+ Ty = GetElementPtrInst::getIndexedType(PTy, Result.begin(),
+ Result.end(),true);
if (!Ty)
error("Index list invalid for constant getelementptr");
}
@@ -1579,7 +1579,8 @@
}
}
Result.push_back(Index);
- Ty = GetElementPtrInst::getIndexedType(PTy, &Result[0], Result.size(),true);
+ Ty = GetElementPtrInst::getIndexedType(PTy, Result.begin(),
+ Result.end(),true);
if (!Ty)
error("Index list invalid for constant getelementptr");
}
@@ -3890,7 +3891,7 @@
upgradeGEPInstIndices(Ty, $4, VIndices);
Value* tmpVal = getVal(Ty, $3);
- $$.I = new GetElementPtrInst(tmpVal, &VIndices[0], VIndices.size());
+ $$.I = new GetElementPtrInst(tmpVal, VIndices.begin(), VIndices.end());
ValueInfo VI; VI.V = tmpVal; VI.S.copy($2.S);
$$.S.copy(getElementSign(VI, VIndices));
delete $2.PAT;
diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp
index 99d79de..a481372 100644
--- a/tools/llvm2cpp/CppWriter.cpp
+++ b/tools/llvm2cpp/CppWriter.cpp
@@ -787,7 +787,8 @@
Out << "Constant* " << constName
<< " = ConstantExpr::getGetElementPtr("
<< getCppName(CE->getOperand(0)) << ", "
- << "&" << constName << "_indices[0], " << CE->getNumOperands() - 1
+ << constName << "_indices.begin(), "
+ << constName << "_indices.end(), "
<< " );";
} else if (CE->isCast()) {
printConstant(CE->getOperand(0));
@@ -1253,8 +1254,8 @@
nl(Out);
}
Out << "Instruction* " << iName << " = new GetElementPtrInst("
- << opNames[0] << ", &" << iName << "_indices[0], "
- << gep->getNumOperands() - 1;
+ << opNames[0] << ", " << iName << "_indices.begin(), "
+ << iName << "_indices.end()";
}
Out << ", \"";
printEscapedString(gep->getName());