fix PR3859: crash with 'cc -V'

llvm-svn: 67472
This commit is contained in:
Nuno Lopes 2009-03-22 17:47:44 +00:00
parent b1656c1e1f
commit 34cef4c1c8
1 changed files with 3 additions and 2 deletions

View File

@ -162,8 +162,9 @@ void SeparateArg::render(const ArgList &Args, ArgStringList &Output) const {
Output.push_back(Args.MakeArgString(Joined.c_str()));
} else {
Output.push_back(Args.getArgString(getIndex()));
for (unsigned i = 0; i < NumValues; ++i)
Output.push_back(Args.getArgString(getIndex() + 1 + i));
unsigned limit = std::min(Args.size(), getIndex() + 1 + NumValues);
for (unsigned i = getIndex() + 1; i < limit; ++i)
Output.push_back(Args.getArgString(i));
}
}