Skip to content

Commit fe74df0

Browse files
committed
[lldb] Specify default value for platform.module-cache-directory
In addition to the commit rG352f16db87f583ec7f55f8028647b5fd8616111f, this one fixes settings behavior on clearing - the setting should be reverted to their default value, not an empty one.
1 parent 05334de commit fe74df0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lldb/include/lldb/Target/Platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class PlatformProperties : public Properties {
5050

5151
FileSpec GetModuleCacheDirectory() const;
5252
bool SetModuleCacheDirectory(const FileSpec &dir_spec);
53+
54+
private:
55+
void SetDefaultModuleCacheDirectory(const FileSpec &dir_spec);
5356
};
5457

5558
typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;

lldb/source/Target/Platform.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "lldb/Host/Host.h"
2727
#include "lldb/Host/HostInfo.h"
2828
#include "lldb/Host/OptionParser.h"
29+
#include "lldb/Interpreter/OptionValueFileSpec.h"
2930
#include "lldb/Interpreter/OptionValueProperties.h"
3031
#include "lldb/Interpreter/Property.h"
3132
#include "lldb/Symbol/ObjectFile.h"
@@ -93,6 +94,7 @@ PlatformProperties::PlatformProperties() {
9394
module_cache_dir = FileSpec(user_home_dir.c_str());
9495
module_cache_dir.AppendPathComponent(".lldb");
9596
module_cache_dir.AppendPathComponent("module_cache");
97+
SetDefaultModuleCacheDirectory(module_cache_dir);
9698
SetModuleCacheDirectory(module_cache_dir);
9799
}
98100

@@ -117,6 +119,14 @@ bool PlatformProperties::SetModuleCacheDirectory(const FileSpec &dir_spec) {
117119
nullptr, ePropertyModuleCacheDirectory, dir_spec);
118120
}
119121

122+
void PlatformProperties::SetDefaultModuleCacheDirectory(
123+
const FileSpec &dir_spec) {
124+
auto f_spec_opt = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(
125+
nullptr, false, ePropertyModuleCacheDirectory);
126+
assert(f_spec_opt);
127+
f_spec_opt->SetDefaultValue(dir_spec);
128+
}
129+
120130
/// Get the native host platform plug-in.
121131
///
122132
/// There should only be one of these for each host that LLDB runs

0 commit comments

Comments
 (0)