Use a safer iterator interface and get rid of std C++ library misuse.

This fixes a --enable-expensive-checks problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Greene 2009-04-17 14:56:18 +00:00
parent 2a5a12cd69
commit 5b7dfbd89a

View File

@ -565,11 +565,10 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Add a parameter to the function for each element passed in.
for (ScalarizeTable::iterator SI = ArgIndices.begin(),
E = ArgIndices.end(); SI != E; ++SI) {
unsigned num = SI->size();
// not allowed to dereference ->begin() if size() is 0
Params.push_back(GetElementPtrInst::getIndexedType(I->getType(),
num ? &*SI->begin(): 0,
num));
SI->begin(),
SI->end()));
assert(Params.back());
}