Yea I don’t think this addresses the problem.  We should be able to link against parts of lldb without a dependency on clang.  Since this is about configuring something related to clang, it seems like it should be isolated to some part of lldb that interfaces with clang <br><div class="gmail_quote"><div dir="ltr">On Tue, May 22, 2018 at 4:32 PM Adrian Prantl via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">aprantl created this revision.<br>
aprantl added reviewers: zturner, jingham.<br>
Herald added subscribers: jkorous, MaskRay, ioeric, ilya-biryukov, mgorny.<br>
<br>
@zturner wrote:<br>
<br>
> 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?<br>
<br>
This is implementing Jim's suggestions in <a href="http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180521/041010.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180521/041010.html</a> .<br>
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.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D47235" rel="noreferrer" target="_blank">https://reviews.llvm.org/D47235</a><br>
<br>
Files:<br>
  include/lldb/Host/HostInfoBase.h<br>
  source/Core/ModuleList.cpp<br>
  source/Host/CMakeLists.txt<br>
  source/Host/common/HostInfoBase.cpp<br>
<br>
<br>
Index: source/Host/common/HostInfoBase.cpp<br>
===================================================================<br>
--- source/Host/common/HostInfoBase.cpp<br>
+++ source/Host/common/HostInfoBase.cpp<br>
@@ -25,6 +25,8 @@<br>
 #include "llvm/Support/Threading.h"<br>
 #include "llvm/Support/raw_ostream.h"<br>
<br>
+#include "clang/Driver/Driver.h"<br>
+<br>
 #include <mutex><br>
 #include <thread><br>
<br>
@@ -387,3 +389,9 @@<br>
     break;<br>
   }<br>
 }<br>
+<br>
+std::string HostInfoBase::GetDefaultClangModuleCachePath() {<br>
+  llvm::SmallString<128> path;<br>
+  clang::driver::Driver::getDefaultModuleCachePath(path);<br>
+  return path.str();<br>
+}<br>
Index: source/Host/CMakeLists.txt<br>
===================================================================<br>
--- source/Host/CMakeLists.txt<br>
+++ source/Host/CMakeLists.txt<br>
@@ -185,7 +185,8 @@<br>
     lldbUtility<br>
     ${LLDB_PLUGINS}<br>
     ${EXTRA_LIBS}<br>
-  <br>
+    clangDriver<br>
+    <br>
   LINK_COMPONENTS<br>
     Object<br>
     Support<br>
Index: source/Core/ModuleList.cpp<br>
===================================================================<br>
--- source/Core/ModuleList.cpp<br>
+++ source/Core/ModuleList.cpp<br>
@@ -13,6 +13,7 @@<br>
 #include "lldb/Core/ModuleSpec.h"<br>
 #include "lldb/Host/FileSystem.h"<br>
 #include "lldb/Host/Symbols.h"<br>
+#include "lldb/Host/HostInfoBase.h"<br>
 #include "lldb/Interpreter/OptionValueProperties.h"<br>
 #include "lldb/Interpreter/OptionValueFileSpec.h"<br>
 #include "lldb/Interpreter/Property.h"<br>
@@ -34,7 +35,6 @@<br>
 #include "llvm/Support/FileSystem.h"<br>
 #include "llvm/Support/Threading.h"<br>
 #include "llvm/Support/raw_ostream.h" // for fs<br>
-#include "clang/Driver/Driver.h"<br>
<br>
 #include <chrono> // for operator!=, time_point<br>
 #include <memory> // for shared_ptr<br>
@@ -85,9 +85,7 @@<br>
   m_collection_sp.reset(new OptionValueProperties(ConstString("symbols")));<br>
   m_collection_sp->Initialize(g_properties);<br>
<br>
-  llvm::SmallString<128> path;<br>
-  clang::driver::Driver::getDefaultModuleCachePath(path);<br>
-  SetClangModulesCachePath(path);<br>
+  SetClangModulesCachePath(HostInfoBase::GetDefaultClangModuleCachePath());<br>
 }<br>
<br>
 bool ModuleListProperties::GetEnableExternalLookup() const {<br>
Index: include/lldb/Host/HostInfoBase.h<br>
===================================================================<br>
--- include/lldb/Host/HostInfoBase.h<br>
+++ include/lldb/Host/HostInfoBase.h<br>
@@ -90,6 +90,9 @@<br>
   //---------------------------------------------------------------------------<br>
   static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);<br>
<br>
+  /// Return the default path for the Clang module cache.<br>
+  static std::string GetDefaultClangModuleCachePath();<br>
+  <br>
 protected:<br>
   static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);<br>
   static bool ComputeSupportExeDirectory(FileSpec &file_spec);<br>
<br>
<br>
</blockquote></div>