[PATCH] D55024: [lit] Fix tool substitution when paths or arguments contain spaces

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 28 15:59:09 PST 2018


rnk added inline comments.


================
Comment at: llvm/utils/lit/lit/llvm/subst.py:134-139
+                quote_ch = '"' if sys.platform == 'win32' else "'"
+                if x[0] != quote_ch:
+                    x = quote_ch + x
+                if x[-1] != quote_ch:
+                    x = x + quote_ch
+                return x
----------------
This is in LLVM, so let's just assume we're dealing with the lit internal shell or bash. In that case, we can use `'` everywhere and the escaping is easy:
  return "\'" + x.replace(r"'", r"'\''") + "\'"

Then you don't need a big comment explaining why we only care about spaces etc.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55024/new/

https://reviews.llvm.org/D55024





More information about the llvm-commits mailing list