diff --git a/llvm/utils/lit/lit/ShUtil.py b/llvm/utils/lit/lit/ShUtil.py index ff151b1e29330..f3778ad23fddf 100644 --- a/llvm/utils/lit/lit/ShUtil.py +++ b/llvm/utils/lit/lit/ShUtil.py @@ -117,7 +117,7 @@ def lex_arg_quoted(self, delim): return str # LLDB uses "$" at the start of global variable names; it should # not be escaped nor dropped. - elif c == "\\" and self.look() == "$": + elif c == "\\" and self.look() == "$" and delim == '"': c = self.eat() str += c elif c == "\\" and delim == '"': diff --git a/llvm/utils/lit/tests/unit/ShUtil.py b/llvm/utils/lit/tests/unit/ShUtil.py index 877fc007b8678..2904125b084f2 100644 --- a/llvm/utils/lit/tests/unit/ShUtil.py +++ b/llvm/utils/lit/tests/unit/ShUtil.py @@ -30,6 +30,8 @@ def test_quoting(self): self.assertEqual(self.lex(""" a\\ b """, win32Escapes=True), ["a\\", "b"]) self.assertEqual(self.lex('"\\$y = 11"'), ["$y = 11"]) self.assertEqual(self.lex('"expr \\$y = 11"'), ["expr $y = 11"]) + self.assertEqual(self.lex("'\\$y = 11'"), ["\\$y = 11"]) + self.assertEqual(self.lex("'expr \\$y = 11'"), ["expr \\$y = 11"]) class TestShParse(unittest.TestCase): def parse(self, str):