[llvm] [lit] Update internal shell lexer to handle LLDB persistent vars. (PR #156125)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 29 16:58:34 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: None (cmtice)
<details>
<summary>Changes</summary>
LLDB allows creation of 'persistent' variables, with names that start with '$'. The lit internal shell was escaping the '$', making it '\$', in some CHECK lines, which causes some LLDB tests to fail when using the lit internal shell.
This PR fixes that by having the lexer remove the escape on the '$'.
---
Full diff: https://github.com/llvm/llvm-project/pull/156125.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/ShUtil.py (+5)
``````````diff
diff --git a/llvm/utils/lit/lit/ShUtil.py b/llvm/utils/lit/lit/ShUtil.py
index fa13167cad1be..ff151b1e29330 100644
--- a/llvm/utils/lit/lit/ShUtil.py
+++ b/llvm/utils/lit/lit/ShUtil.py
@@ -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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/156125
More information about the llvm-commits
mailing list