summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt1
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp13
-rw-r--r--lldb/source/Target/Target.cpp13
3 files changed, 20 insertions, 7 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
index a780e7d597b..5e45319091f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -23,6 +23,7 @@ add_lldb_library(lldbPluginExpressionParserClang PLUGIN
LINK_LIBS
clangAST
clangCodeGen
+ clangDriver
clangEdit
clangFrontend
clangLex
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index b42ceb9afee..3729910c8a1 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -13,6 +13,7 @@
// Other libraries and framework includes
#include "clang/Basic/TargetInfo.h"
+#include "clang/Driver/Driver.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Lex/Preprocessor.h"
@@ -590,14 +591,12 @@ ClangModulesDeclVendor::Create(Target &target) {
// Add additional search paths with { "-I", path } or { "-F", path } here.
{
- llvm::SmallString<128> DefaultModuleCache;
- const bool erased_on_reboot = false;
- llvm::sys::path::system_temp_directory(erased_on_reboot,
- DefaultModuleCache);
- llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
- llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
+ llvm::SmallString<128> Path;
+ target.GetClangModulesCachePath().GetPath(Path);
+ if (Path.empty())
+ clang::driver::Driver::getDefaultModuleCachePath(Path);
std::string module_cache_argument("-fmodules-cache-path=");
- module_cache_argument.append(DefaultModuleCache.str().str());
+ module_cache_argument.append(Path.str());
compiler_invocation_arguments.push_back(module_cache_argument);
}
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 1464d4c999c..19e1d25fc35 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3509,6 +3509,9 @@ static PropertyDefinition g_properties[] = {
OptionValue::eTypeString, nullptr, nullptr,
"A list of trap handler function names, e.g. a common Unix user process "
"one is _sigtramp."},
+ {"clang-modules-cache-path",
+ OptionValue::eTypeFileSpec, false, 0, nullptr, nullptr,
+ "The path to the clang modules cache directory (-fmodules-cache-path)."},
{"display-runtime-support-values", OptionValue::eTypeBoolean, false, false,
nullptr, nullptr, "If true, LLDB will show variables that are meant to "
"support the operation of a language's runtime "
@@ -3558,6 +3561,7 @@ enum {
ePropertyMemoryModuleLoadLevel,
ePropertyDisplayExpressionsInCrashlogs,
ePropertyTrapHandlerNames,
+ ePropertyClangModulesCachePath,
ePropertyDisplayRuntimeSupportValues,
ePropertyNonStopModeEnabled,
ePropertyExperimental
@@ -3937,6 +3941,15 @@ FileSpecList &TargetProperties::GetDebugFileSearchPaths() {
return option_value->GetCurrentValue();
}
+FileSpec &TargetProperties::GetClangModulesCachePath() {
+ const uint32_t idx = ePropertyClangModulesCachePath;
+ OptionValueFileSpec *option_value =
+ m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
+ idx);
+ assert(option_value);
+ return option_value->GetCurrentValue();
+}
+
FileSpecList &TargetProperties::GetClangModuleSearchPaths() {
const uint32_t idx = ePropertyClangModuleSearchPaths;
OptionValueFileSpecList *option_value =
OpenPOWER on IntegriCloud