[Lldb-commits] [lldb] r333248 - HostInfoMacOSX: Support finding the clang resource directory within CLTools.
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Thu May 24 17:29:01 PDT 2018
Author: adrian
Date: Thu May 24 17:29:01 2018
New Revision: 333248
URL: http://llvm.org/viewvc/llvm-project?rev=333248&view=rev
Log:
HostInfoMacOSX: Support finding the clang resource directory within CLTools.
rdar://problem/40537961
Modified:
lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
lldb/trunk/unittests/Host/HostInfoTest.cpp
Modified: lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm?rev=333248&r1=333247&r2=333248&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm (original)
+++ lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm Thu May 24 17:29:01 2018
@@ -271,7 +271,7 @@ bool HostInfoMacOSX::ComputeClangDirecto
auto parent = std::next(rev_it);
if (parent != r_end && *parent == "SharedFrameworks") {
// This is the top-level LLDB in the Xcode.app bundle.
- // e.g., "Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A"
+ // E.g., "Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A"
raw_path.resize(parent - r_end);
llvm::sys::path::append(clang_path, raw_path,
"Developer/Toolchains/XcodeDefault.xctoolchain",
@@ -282,17 +282,21 @@ bool HostInfoMacOSX::ComputeClangDirecto
}
} else if (parent != r_end && *parent == "PrivateFrameworks" &&
std::distance(parent, r_end) > 2) {
- // This is LLDB inside an Xcode toolchain.
- // e.g., "Xcode.app/Contents/Developer/Toolchains/" \
- // "My.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework"
++parent;
++parent;
- raw_path.resize(parent - r_end);
- llvm::sys::path::append(clang_path, raw_path, swift_clang_resource_dir);
- if (!verify || VerifyClangPath(clang_path)) {
- file_spec.SetFile(clang_path.c_str(), true);
- return true;
+ if (*parent == "System") {
+ // This is LLDB inside an Xcode toolchain.
+ // E.g., "Xcode.app/Contents/Developer/Toolchains/" \
+ // "My.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework"
+ raw_path.resize(parent - r_end);
+ llvm::sys::path::append(clang_path, raw_path, swift_clang_resource_dir);
+ if (!verify || VerifyClangPath(clang_path)) {
+ file_spec.SetFile(clang_path.c_str(), true);
+ return true;
+ }
+ raw_path = lldb_shlib_spec.GetPath();
}
+ raw_path.resize(rev_it - r_end);
} else {
raw_path.resize(rev_it - r_end);
}
Modified: lldb/trunk/unittests/Host/HostInfoTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/HostInfoTest.cpp?rev=333248&r1=333247&r2=333248&view=diff
==============================================================================
--- lldb/trunk/unittests/Host/HostInfoTest.cpp (original)
+++ lldb/trunk/unittests/Host/HostInfoTest.cpp Thu May 24 17:29:01 2018
@@ -90,6 +90,14 @@ TEST_F(HostInfoTest, MacOSX) {
"Swift-4.1-development-snapshot.xctoolchain/usr/lib/swift/clang";
EXPECT_EQ(HostInfoMacOSXTest::ComputeClangDir(toolchain), toolchain_clang);
+ std::string cltools = "/Library/Developer/CommandLineTools/Library/"
+ "PrivateFrameworks/LLDB.framework";
+ std::string cltools_clang =
+ "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/"
+ "LLDB.framework/Resources/Clang";
+ EXPECT_EQ(HostInfoMacOSXTest::ComputeClangDir(cltools), cltools_clang);
+
+
// Test that a bogus path is detected.
EXPECT_NE(HostInfoMacOSXTest::ComputeClangDir(GetInputFilePath(xcode), true),
HostInfoMacOSXTest::ComputeClangDir(GetInputFilePath(xcode)));
More information about the lldb-commits
mailing list