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); 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 // for operator!=, time_point #include // 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: 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/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 #include @@ -387,3 +389,9 @@ break; } } + +std::string HostInfoBase::GetDefaultClangModuleCachePath() { + llvm::SmallString<128> path; + clang::driver::Driver::getDefaultModuleCachePath(path); + return path.str(); +}