aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2024-08-22 12:57:39 +0300
committerGitHub <noreply@github.com>2024-08-22 12:57:39 +0300
commit51ca2354d0a4083b9219df131ceff98bccb622b4 (patch)
tree3e6f426de5436bd0e62e1a54eb3ab4697e82c6bb /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
parent57dc09341e5eef758b1abce78822c51069157869 (diff)
downloadllvm-51ca2354d0a4083b9219df131ceff98bccb622b4.zip
llvm-51ca2354d0a4083b9219df131ceff98bccb622b4.tar.gz
llvm-51ca2354d0a4083b9219df131ceff98bccb622b4.tar.bz2
[lit] Fix substitutions containing backslashes (#103042)
Substitutions can be added in a couple different ways; they can be added via the calling python scripts by adding entries to the config.substitutions dictionary, or via DEFINE lines in the scripts themselves. The substitution strings passed to Python's re classes are interpreted so that backslashes expand to escape sequences, and literal backslashes need to be escaped. On Unix, the script defined substitutions don't (usually, so far) contain backslashes - but on Windows, they often do, due to paths containing backslashes. This lead to a Windows specific escaping of backslashes before doing Python re substitutions - since 7c9eab8fef0ed79a5911d21eb97b6b0fa9d39f82. There's nothing inherently Windows specific about this though - any intended literal backslashes in the substitution strings need to be escaped; this is how the Python re API works. The DEFINE lines were added later, and in order to cope with backslashes, escaping of backslashes was added in the SubstDirective class in TestRunner, applying to DEFINE lines in the tests only. The fact that the escaping right before passing to the Python re API was done conditionally on Windows led to two inconsistencies: - DEFINE lines in the tests that contain backslashes got double backslashes on Windows. (This was visible as a FIXME in llvm/utils/lit/tests/Inputs/shtest-define/value-escaped.txt.) - Script provided substitutions containing backslashes did not work on Unix, but they did work on Windows. By removing the escaping from SubstDirective and escaping it unconditionally in the processLine function, before feeding the substitutions to Python's re classes, we should have consistent behaviour across platforms, and get rid of the FIXME in the lit test. This fixes issues with substitutions containing backslashes on Unix platforms, as encountered in PR #86649.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h')
0 files changed, 0 insertions, 0 deletions