forked from OSchip/llvm-project
Yet another follow-up to r332111. This also handles the case where an
LLDB.framework is built inside the LLDB build directory (but not inside an Xcode installation). llvm-svn: 332126
This commit is contained in:
parent
02aba94e76
commit
3a380fb2ff
|
@ -268,10 +268,11 @@ bool HostInfoMacOSX::ComputeClangDirectory(FileSpec &lldb_shlib_spec,
|
|||
// same Clang module cache.
|
||||
llvm::SmallString<256> clang_path;
|
||||
const char *swift_clang_resource_dir = "usr/lib/swift/clang";
|
||||
++rev_it;
|
||||
if (rev_it != r_end && *rev_it == "SharedFrameworks") {
|
||||
auto parent = std::next(rev_it);
|
||||
if (parent != r_end && *parent == "SharedFrameworks") {
|
||||
// This is the top-level LLDB in the Xcode.app bundle.
|
||||
raw_path.resize(rev_it - r_end);
|
||||
// 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",
|
||||
swift_clang_resource_dir);
|
||||
|
@ -279,10 +280,14 @@ bool HostInfoMacOSX::ComputeClangDirectory(FileSpec &lldb_shlib_spec,
|
|||
file_spec.SetFile(clang_path.c_str(), true);
|
||||
return true;
|
||||
}
|
||||
} else if (rev_it != r_end && *rev_it == "PrivateFrameworks" &&
|
||||
++rev_it != r_end && ++rev_it != r_end) {
|
||||
} else if (parent != r_end && *parent == "PrivateFrameworks" &&
|
||||
std::distance(parent, r_end) > 2) {
|
||||
// This is LLDB inside an Xcode toolchain.
|
||||
raw_path.resize(rev_it - r_end);
|
||||
// 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);
|
||||
|
@ -293,7 +298,7 @@ bool HostInfoMacOSX::ComputeClangDirectory(FileSpec &lldb_shlib_spec,
|
|||
}
|
||||
|
||||
// Fall back to the Clang resource directory inside the framework.
|
||||
raw_path.append("/Resources/Clang");
|
||||
raw_path.append("LLDB.framework/Resources/Clang");
|
||||
file_spec.SetFile(raw_path.c_str(), true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -63,11 +63,11 @@ TEST_F(HostInfoTest, MacOSX) {
|
|||
std::string posix = "/usr/lib/liblldb.dylib";
|
||||
EXPECT_FALSE(HostInfoMacOSXTest::ComputeClangDir(posix).empty());
|
||||
|
||||
std::string framework =
|
||||
"/SharedFrameworks/LLDB.framework";
|
||||
std::string framework_clang =
|
||||
"/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang";
|
||||
EXPECT_EQ(HostInfoMacOSXTest::ComputeClangDir(framework), framework_clang);
|
||||
std::string build =
|
||||
"/lldb-macosx-x86_64/Library/Frameworks/LLDB.framework/Versions/A";
|
||||
std::string build_clang =
|
||||
"/lldb-macosx-x86_64/Library/Frameworks/LLDB.framework/Resources/Clang";
|
||||
EXPECT_EQ(HostInfoMacOSXTest::ComputeClangDir(build), build_clang);
|
||||
|
||||
std::string xcode =
|
||||
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A";
|
||||
|
|
Loading…
Reference in New Issue