[Lldb-commits] [lldb] fe74df0 - [lldb] Specify default value for platform.module-cache-directory

Tatyana Krasnukha via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 12 12:08:36 PDT 2020


Author: Tatyana Krasnukha
Date: 2020-03-12T22:08:12+03:00
New Revision: fe74df01a909fb02528e83e90124f1b706176ddd

URL: https://github.com/llvm/llvm-project/commit/fe74df01a909fb02528e83e90124f1b706176ddd
DIFF: https://github.com/llvm/llvm-project/commit/fe74df01a909fb02528e83e90124f1b706176ddd.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/include/lldb/Target/Platform.h
    lldb/source/Target/Platform.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index f347e7beae28..7c2746ddec68 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -50,6 +50,9 @@ class PlatformProperties : public Properties {
 
   FileSpec GetModuleCacheDirectory() const;
   bool SetModuleCacheDirectory(const FileSpec &dir_spec);
+
+private:
+  void SetDefaultModuleCacheDirectory(const FileSpec &dir_spec);
 };
 
 typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 3739ccd7edc6..eaa71b9cbbd0 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -26,6 +26,7 @@
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/OptionParser.h"
+#include "lldb/Interpreter/OptionValueFileSpec.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Interpreter/Property.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -93,6 +94,7 @@ PlatformProperties::PlatformProperties() {
   module_cache_dir = FileSpec(user_home_dir.c_str());
   module_cache_dir.AppendPathComponent(".lldb");
   module_cache_dir.AppendPathComponent("module_cache");
+  SetDefaultModuleCacheDirectory(module_cache_dir);
   SetModuleCacheDirectory(module_cache_dir);
 }
 
@@ -117,6 +119,14 @@ bool PlatformProperties::SetModuleCacheDirectory(const FileSpec &dir_spec) {
       nullptr, ePropertyModuleCacheDirectory, dir_spec);
 }
 
+void PlatformProperties::SetDefaultModuleCacheDirectory(
+    const FileSpec &dir_spec) {
+  auto f_spec_opt = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(
+        nullptr, false, ePropertyModuleCacheDirectory);
+  assert(f_spec_opt);
+  f_spec_opt->SetDefaultValue(dir_spec);
+}
+
 /// Get the native host platform plug-in.
 ///
 /// There should only be one of these for each host that LLDB runs


        


More information about the lldb-commits mailing list