Fix a regression in r332111. The LLDB.framework path component is not

usually the last component.

llvm-svn: 332120
This commit is contained in:
Adrian Prantl 2018-05-11 19:00:58 +00:00
parent 99d5c072f0
commit 5103e48bad
2 changed files with 14 additions and 2 deletions

View File

@ -253,7 +253,13 @@ bool HostInfoMacOSX::ComputeClangDirectory(FileSpec &lldb_shlib_spec,
auto r_end = llvm::sys::path::rend(raw_path);
// Check for a Posix-style build of LLDB.
if (rev_it == r_end || *rev_it != "LLDB.framework")
while (rev_it != r_end) {
if (*rev_it == "LLDB.framework")
break;
++rev_it;
}
if (rev_it == r_end)
return HostInfoPosix::ComputeClangDirectory(file_spec);
// Inside Xcode and in Xcode toolchains LLDB is always in lockstep

View File

@ -63,8 +63,14 @@ 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 xcode =
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework";
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A";
std::string xcode_clang =
"/Applications/Xcode.app/Contents/Developer/Toolchains/"
"XcodeDefault.xctoolchain/usr/lib/swift/clang";