diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2009-03-22 17:47:44 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2009-03-22 17:47:44 +0000 |
commit | 378fd73b5721186f16b4510b7877f13939505160 (patch) | |
tree | 8f63a163196358796617541df360853a803f1e3e /lib/Driver/Arg.cpp | |
parent | 22f0d09298ef05136f1ef6ebc4469b482cbd73e7 (diff) |
fix PR3859: crash with 'cc -V'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Arg.cpp')
-rw-r--r-- | lib/Driver/Arg.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Driver/Arg.cpp b/lib/Driver/Arg.cpp index c43c9fbe4b..df75a5dd79 100644 --- a/lib/Driver/Arg.cpp +++ b/lib/Driver/Arg.cpp @@ -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)); } } |