[clang] Fix `run_clang_repl` output when not present (PR #161412)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 30 11:03:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Jeaye Wilkerson (jeaye)

<details>
<summary>Changes</summary>

On the happy path, when `clang-repl` is present, we will invoke it in order to determine if the host supports JIT features. That will return a string containing "true". However, in cases where `clang-repl` is not present or we fail to invoke it, we previously returned `False`, which would then trigger a failure with our substring check. This PR updates the function to return `""` instead, so the substring check is still valid.

This is related to https://github.com/llvm/llvm-project/pull/157359, where the original change was introduced.

@<!-- -->vgvassilev for review.

---
Full diff: https://github.com/llvm/llvm-project/pull/161412.diff


1 Files Affected:

- (modified) clang/test/lit.cfg.py (+2-2) 


``````````diff
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 64e2bbad8f3b2..e6c79d7a71b51 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -145,7 +145,7 @@ def run_clang_repl(args):
     clang_repl_exe = lit.util.which("clang-repl", config.clang_tools_dir)
 
     if not clang_repl_exe:
-        return False
+        return ""
 
     try:
         clang_repl_cmd = subprocess.Popen(
@@ -153,7 +153,7 @@ def run_clang_repl(args):
         )
     except OSError:
         print("could not exec clang-repl")
-        return False
+        return ""
 
     clang_repl_out = clang_repl_cmd.stdout.read().decode("ascii")
     clang_repl_cmd.wait()

``````````

</details>


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


More information about the cfe-commits mailing list