[cfe-commits] r67472 - /cfe/trunk/lib/Driver/Arg.cpp

Nuno Lopes nunoplopes at sapo.pt
Sun Mar 22 10:47:45 PDT 2009


Author: nlopes
Date: Sun Mar 22 12:47:44 2009
New Revision: 67472

URL: http://llvm.org/viewvc/llvm-project?rev=67472&view=rev
Log:
fix PR3859: crash with 'cc -V'

Modified:
    cfe/trunk/lib/Driver/Arg.cpp

Modified: cfe/trunk/lib/Driver/Arg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=67472&r1=67471&r2=67472&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Arg.cpp (original)
+++ cfe/trunk/lib/Driver/Arg.cpp Sun Mar 22 12:47:44 2009
@@ -162,8 +162,9 @@
     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));
   }
 }
 





More information about the cfe-commits mailing list