[Lldb-commits] [lldb] [lldb][test] Don't treat 'xcrun clang' as a path for finding clang++ (PR #188235)

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 24 05:20:50 PDT 2026


https://github.com/Teemperor created https://github.com/llvm/llvm-project/pull/188235

TestPrintObjectArray.py currently runs `clang++` when compiling the test source, even though we specified that the test source should be compiled with `xcrun clang`. We end up in this situation as we treat this command as a path when trying to assemble the `clang++` command.

This patch just adds a special case that if the path is not a file path or symlink, then we assembly the `clang++` command by just appending the extension to the command.

>From 5e2b2643b60206d001021178c2d9517f2a918e3c Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Tue, 24 Mar 2026 12:12:43 +0000
Subject: [PATCH] [lldb][test] Don't treat 'xcrun clang' as a path for finding
 clang++

TestPrintObjectArray.py currently runs `clang++` when compiling the
test source, even though we specified that the test source should be
compiled with `xcrun clang`. We end up in this situation as we treat
this command as a path when trying to assemble the `clang++` command.

This patch just adds a special case that if the path is not a file
path or symlink, then we assembly the `clang++` command by just
appending the extension to the command.
---
 lldb/packages/Python/lldbsuite/test/builders/builder.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index 024c9f1c7e435..7ad9658303823 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -159,7 +159,12 @@ def getToolchainSpec(self, compiler):
         def getToolchainUtil(util_name):
             return os.path.join(configuration.llvm_tools_dir, util_name + exe_ext)
 
-        cxx = cc_dir / (cc_prefix + cxx_type + cc_ext)
+        # If the compiler is a file path or symlink, try to infer where the
+        # C++ variant is. Otherwise just append the extension (usually '++').
+        if os.path.exists(cc):
+            cxx = cc_dir / (cc_prefix + cxx_type + cc_ext)
+        else:
+            cxx = cc + cc_ext
 
         util_names = {
             "OBJCOPY": "objcopy",



More information about the lldb-commits mailing list