[Lldb-commits] [PATCH] D47235: Move ModuleList's dependency on clangDriver into Host

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue May 22 18:57:56 PDT 2018


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
On Tue, May 22, 2018 at 4:32 PM Adrian Prantl via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180522/464d15c9/attachment.html>


More information about the lldb-commits mailing list