Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/utils/lit/lit/ShUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def lex_arg_quoted(self, delim):
c = self.eat()
if c == delim:
return str
# LLDB uses "$" at the start of global variable names; it should
# not be escaped nor dropped.
elif c == "\\" and self.look() == "$":
c = self.eat()
str += c
elif c == "\\" and delim == '"':
# Inside a '"' quoted string, '\\' only escapes the quote
# character and backslash, otherwise it is preserved.
Expand Down
3 changes: 2 additions & 1 deletion llvm/utils/lit/tests/unit/ShUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def test_quoting(self):
self.assertEqual(self.lex(""" a\\ b a\\\\b """), ["a b", "a\\b"])
self.assertEqual(self.lex(""" "" "" """), ["", ""])
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"])
Comment on lines +31 to +32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test with single quotes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #156742 for requested fix & test.


class TestShParse(unittest.TestCase):
def parse(self, str):
Expand Down
Loading