Unbreak the build on win32.
[oota-llvm.git] / lib / Support / CommandLine.cpp
index 87dfc5a703fa885d9a36ecd1effd3c4214c258ec..2c56e0ffb87eb0fc5e12c06d1f924466a06fd56d 100644 (file)
@@ -388,23 +388,27 @@ static void ExpandResponseFiles(int argc, char** argv,
       // Check that the response file is not empty (mmap'ing empty
       // files can be problematic).
       const sys::FileStatus *FileStat = respFile.getFileStatus();
-      if (!FileStat)
-        continue;
-      if (FileStat->getSize() == 0)
-        continue;
+      if (FileStat && FileStat->getSize() != 0) {
 
-      // Mmap the response file into memory.
-      OwningPtr<MemoryBuffer>
-        respFilePtr(MemoryBuffer::getFile(respFile.c_str()));
+        // Mmap the response file into memory.
+        OwningPtr<MemoryBuffer>
+          respFilePtr(MemoryBuffer::getFile(respFile.c_str()));
 
-      if (respFilePtr == 0)
-        continue;
+        // If we could open the file, parse its contents, otherwise
+        // pass the @file option verbatim.
 
-      ParseCStringVector(newArgv, respFilePtr->getBufferStart());
-    }
-    else {
-      newArgv.push_back(strdup(arg));
+        // TODO: we should also support recursive loading of response files,
+        // since this is how gcc behaves. (From their man page: "The file may
+        // itself contain additional @file options; any such options will be
+        // processed recursively.")
+
+        if (respFilePtr != 0) {
+          ParseCStringVector(newArgv, respFilePtr->getBufferStart());
+          continue;
+        }
+      }
     }
+    newArgv.push_back(strdup(arg));
   }
 }
 
@@ -868,6 +872,8 @@ bool parser<bool>::parse(Option &O, const char *ArgName,
     return O.error(": '" + Arg +
                    "' is invalid value for boolean argument! Try 0 or 1");
   }
+  if (IsInvertable && strncmp(ArgName+1, "no-", 3) == 0)
+    Value = !Value;
   return false;
 }
 
@@ -878,7 +884,8 @@ bool parser<boolOrDefault>::parse(Option &O, const char *ArgName,
   if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
       Arg == "1") {
     Value = BOU_TRUE;
-  } else if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") {
+  } else if (Arg == "false" || Arg == "FALSE"
+             || Arg == "False" || Arg == "0") {
     Value = BOU_FALSE;
   } else {
     return O.error(": '" + Arg +