[cfe-commits] r66858 - /cfe/trunk/lib/Driver/Driver.cpp

Daniel Dunbar daniel at zuster.org
Thu Mar 12 18:01:44 PDT 2009


Author: ddunbar
Date: Thu Mar 12 20:01:44 2009
New Revision: 66858

URL: http://llvm.org/viewvc/llvm-project?rev=66858&view=rev
Log:
Driver: Ignore empty arguments.

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

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

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Mar 12 20:01:44 2009
@@ -45,6 +45,16 @@
   
   unsigned Index = 0, End = ArgEnd - ArgBegin;
   while (Index < End) {
+    // gcc's handling of empty arguments doesn't make
+    // sense, but this is not a common use case. :)
+    //
+    // We just ignore them here (note that other things may
+    // still take them as arguments).
+    if (Args->getArgString(Index)[0] == '\0') {
+      ++Index;
+      continue;
+    }
+
     unsigned Prev = Index;
     Arg *A = getOpts().ParseOneArg(*Args, Index, End);
     if (A) {
@@ -209,7 +219,7 @@
     return false;
   }
 
-  if (Arg *A = Args.getLastArg(options::OPT_print_libgcc_file_name)) {
+  if (Args.hasArg(options::OPT_print_libgcc_file_name)) {
     llvm::outs() << GetProgramPath("libgcc.a").toString() << "\n";
     return false;
   }





More information about the cfe-commits mailing list