[PATCH] D30704: Allow use of spaces in Bugpoint ‘--compile-command’ argument Bug Fix

Owen Reynolds via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 10:17:02 PST 2017


gbreynoo created this revision.

MatzeB brought to my attention the bug https://bugs.llvm.org/show_bug.cgi?id=32137, caused by my change in https://reviews.llvm.org/D29940. This patch fixes the issue.


https://reviews.llvm.org/D30704

Files:
  ToolRunner.cpp


Index: ToolRunner.cpp
===================================================================
--- ToolRunner.cpp
+++ ToolRunner.cpp
@@ -382,29 +382,29 @@
 
   // first argument is the PATH.
   // Skip repeated whitespace, leading whitespace and trailing whitespace.
-  for (std::size_t Pos = 0u; Pos <= CommandLine.size(); ++Pos) {
-    if ('\\' == CommandLine[Pos]) {
-      if (Pos + 1 < CommandLine.size())
-        Token.push_back(CommandLine[++Pos]);
-
-      continue;
-    }
-    if (' ' == CommandLine[Pos] || CommandLine.size() == Pos) {
-      if (Token.empty())
-        continue;
-
-      if (!FoundPath) {
-        Command = Token;
-        FoundPath = true;
-        Token.clear();
-        continue;
+  for (std::size_t Pos = 0u; Pos <= CommandLine.size (); ++Pos) {
+      if (CommandLine.size () == Pos || ' ' == CommandLine [Pos])
+      {
+          if (Token.empty ())
+              continue;
+
+          if (!FoundPath) {
+              Command = Token;
+              Token.clear ();
+              FoundPath = true;
+              continue;
+          }
+
+          Args.push_back (Token);
+          Token.clear ();
+          continue;
       }
-
-      Args.push_back(Token);
-      Token.clear();
-      continue;
-    }
-    Token.push_back(CommandLine[Pos]);
+      else if ('\\' == CommandLine [Pos]) {
+          if (Pos + 1 < CommandLine.size ())
+              Token.push_back (CommandLine [++Pos]);
+          continue;
+      }
+      Token.push_back (CommandLine [Pos]);
   }
 
   auto Path = sys::findProgramByName(Command);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30704.90877.patch
Type: text/x-patch
Size: 1612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170307/7507987e/attachment.bin>


More information about the llvm-commits mailing list