[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
Wed Mar 25 01:18:06 PDT 2026
https://github.com/Teemperor updated https://github.com/llvm/llvm-project/pull/188235
>From d09c104fa192ffd77cace06f6dfccd4a1502560d 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 uses `xcrun clang` as the test compiler.
This is because the test source requires some Objective-C features
that are only available in downstream clang:
```
self.build(dictionary=[...], compiler="xcrun clang")
```
However, this currently just results in us running `clang++`
instead of `xcrun clang++` to compile test sources. If the downstream
`clang++` in PATH is not Apple's downstream version, this then causes
the tests to fail with compilation errors:
```
clang++: error: unknown argument: '-fno-constant-nsnumber-literals'
clang++: error: unknown argument: '-fno-constant-nsarray-literals'
clang++: error: unknown argument: '-fno-constant-nsdictionary-literals'
```
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