[Lldb-commits] [PATCH] D47235: Move ModuleList's dependency on clangDriver into Host
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue May 22 16:32:01 PDT 2018
aprantl created this revision.
aprantl added reviewers: zturner, jingham.
Herald added subscribers: jkorous, MaskRay, ioeric, ilya-biryukov, mgorny.
@zturner wrote:
> This change has introduced a dependency from Core -> clang Driver (due to #include "clang/Driver/Driver.h" in ModuleList.cpp). Can you please try to find a way to remove this dependency?
This is implementing Jim's suggestions in http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180521/041010.html .
This certainly makes sense from a logical perspective, but I'm not sure whether this addresses Zachary's concerns. Let me know what you think.
https://reviews.llvm.org/D47235
Files:
include/lldb/Host/HostInfoBase.h
source/Core/ModuleList.cpp
source/Host/CMakeLists.txt
source/Host/common/HostInfoBase.cpp
Index: source/Host/common/HostInfoBase.cpp
===================================================================
--- source/Host/common/HostInfoBase.cpp
+++ source/Host/common/HostInfoBase.cpp
@@ -25,6 +25,8 @@
#include "llvm/Support/Threading.h"
#include "llvm/Support/raw_ostream.h"
+#include "clang/Driver/Driver.h"
+
#include <mutex>
#include <thread>
@@ -387,3 +389,9 @@
break;
}
}
+
+std::string HostInfoBase::GetDefaultClangModuleCachePath() {
+ llvm::SmallString<128> path;
+ clang::driver::Driver::getDefaultModuleCachePath(path);
+ return path.str();
+}
Index: source/Host/CMakeLists.txt
===================================================================
--- source/Host/CMakeLists.txt
+++ source/Host/CMakeLists.txt
@@ -185,7 +185,8 @@
lldbUtility
${LLDB_PLUGINS}
${EXTRA_LIBS}
-
+ clangDriver
+
LINK_COMPONENTS
Object
Support
Index: source/Core/ModuleList.cpp
===================================================================
--- source/Core/ModuleList.cpp
+++ source/Core/ModuleList.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Symbols.h"
+#include "lldb/Host/HostInfoBase.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/Property.h"
@@ -34,7 +35,6 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/raw_ostream.h" // for fs
-#include "clang/Driver/Driver.h"
#include <chrono> // for operator!=, time_point
#include <memory> // for shared_ptr
@@ -85,9 +85,7 @@
m_collection_sp.reset(new OptionValueProperties(ConstString("symbols")));
m_collection_sp->Initialize(g_properties);
- llvm::SmallString<128> path;
- clang::driver::Driver::getDefaultModuleCachePath(path);
- SetClangModulesCachePath(path);
+ SetClangModulesCachePath(HostInfoBase::GetDefaultClangModuleCachePath());
}
bool ModuleListProperties::GetEnableExternalLookup() const {
Index: include/lldb/Host/HostInfoBase.h
===================================================================
--- include/lldb/Host/HostInfoBase.h
+++ include/lldb/Host/HostInfoBase.h
@@ -90,6 +90,9 @@
//---------------------------------------------------------------------------
static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
+ /// Return the default path for the Clang module cache.
+ static std::string GetDefaultClangModuleCachePath();
+
protected:
static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47235.148130.patch
Type: text/x-patch
Size: 2646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180522/bd337c7f/attachment.bin>
More information about the lldb-commits
mailing list