[llvm] [lit] Update internal shell lexer to handle LLDB persistent vars. (PR #156125)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 2 09:51:03 PDT 2025
https://github.com/cmtice updated https://github.com/llvm/llvm-project/pull/156125
>From 715a2a79d7516aa381ff86db247cb3d19c9df650 Mon Sep 17 00:00:00 2001
From: Caroline Tice <cmtice at google.com>
Date: Thu, 28 Aug 2025 16:45:34 -0700
Subject: [PATCH] [lit] Update internal shell lexer to handle LLDB persistent
vars.
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 '$'.
---
llvm/utils/lit/lit/ShUtil.py | 5 +++++
1 file changed, 5 insertions(+)
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.
More information about the llvm-commits
mailing list