[llvm] [lit] Add readfile substitution (PR #158441)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 13 15:33:50 PDT 2025


================
@@ -720,6 +720,23 @@ def processRedirects(cmd, stdin_source, cmd_shenv, opened_files):
     return std_fds
 
 
+def _expandLateSubstitutions(arguments, cwd):
+    for i, arg in enumerate(arguments):
+        if not isinstance(arg, str):
+            continue
+
+        def _replaceReadFile(match):
+            filePath = match.group(1)
+            if not os.path.isabs(filePath):
+                filePath = os.path.join(cwd, filePath)
+            with open(filePath) as fileHandle:
----------------
cmtice wrote:

And fail gracefully otherwise.

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


More information about the llvm-commits mailing list