[Lldb-commits] [PATCH] D59708: [ExpressionParser] Add swift-lldb case for finding clang resource dir
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 22 11:22:40 PDT 2019
xiaobai created this revision.
xiaobai added reviewers: aprantl, davide, compnerd, JDevlieghere, jingham.
I'm adding this to reduce the difference between swift-lldb and
llvm.org's lldb.
https://reviews.llvm.org/D59708
Files:
source/Plugins/ExpressionParser/Clang/ClangHost.cpp
Index: source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -45,6 +45,8 @@
std::string raw_path = lldb_shlib_spec.GetPath();
llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);
+ // LLVM.org's build of LLDB uses the clang resource directory placed in
+ // $install_dir/lib/clang/$clang_version
llvm::SmallString<256> clang_dir(parent_dir);
llvm::SmallString<32> relative_path;
llvm::sys::path::append(relative_path,
@@ -58,6 +60,18 @@
return true;
}
+ // swift-lldb uses the clang resource directory copied from swift, which by
+ // default is placed in $install_dir/lib/lldb/clang
+ clang_dir = parent_dir;
+ relative_path.clear();
+ llvm::sys::path::append(relative_path, "lib", "lldb", "clang");
+ llvm::sys::path::append(clang_dir, relative_path);
+ if (!verify || VerifyClangPath(clang_dir)) {
+ file_spec.GetDirectory().SetString(clang_dir);
+ FileSystem::Instance().Resolve(file_spec);
+ return true;
+ }
+
return HostInfo::ComputePathRelativeToLibrary(file_spec, relative_path);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59708.191912.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190322/7e484278/attachment.bin>
More information about the lldb-commits
mailing list