[llvm] [lit] Fix substitutions containing backslashes (PR #103042)

Joel E. Denny via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 09:22:16 PDT 2024


Martin =?utf-8?q?Storsjö?= <martin at martin.st>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/103042 at github.com>


================
@@ -22,6 +22,7 @@ config.substitutions.insert(0, ("%{global:greeting}", ""))
 config.substitutions.insert(
     0, ("%{global:echo}", "echo GLOBAL: %{global:greeting} %{global:what}")
 )
+config.substitutions.insert(0, ("%{global:subst-with-escapes}", r"value-with-\g"))
----------------
jdenny-ornl wrote:

The existing comments above don't describe this substitution.

```suggestion
config.substitutions.insert(
    0, ("%{global:echo}", "echo GLOBAL: %{global:greeting} %{global:what}")
)

# This substitution includes an re.sub replacement string escape sequence, 
# which lit should treat as plain text.
config.substitutions.insert(0, ("%{global:subst-with-escapes}", r"value-with-\g"))
```

https://github.com/llvm/llvm-project/pull/103042


More information about the llvm-commits mailing list