[Lldb-commits] [PATCH] D92772: [lldb] Fix that symbols.clang-modules-cache-path is never initialized

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 10 04:38:13 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG208e3f5d9b6c: [lldb] Fix that symbols.clang-modules-cache-path is never initialized (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92772/new/

https://reviews.llvm.org/D92772

Files:
  lldb/include/lldb/Core/ModuleList.h
  lldb/source/Core/ModuleList.cpp
  lldb/test/Shell/Settings/TestDefaultModuleCachePath.test
  lldb/test/Shell/helper/toolchain.py


Index: lldb/test/Shell/helper/toolchain.py
===================================================================
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -54,6 +54,10 @@
                   command=FindTool('lldb'),
                   extra_args=['-S', lldb_init],
                   unresolved='fatal'),
+        ToolSubst('%lldb-noinit',
+                  command=FindTool('lldb'),
+                  extra_args=['--no-lldbinit'],
+                  unresolved='fatal'),
         ToolSubst('%lldb-server',
                   command=FindTool("lldb-server"),
                   extra_args=[],
Index: lldb/test/Shell/Settings/TestDefaultModuleCachePath.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Settings/TestDefaultModuleCachePath.test
@@ -0,0 +1,9 @@
+# RUN: %lldb-noinit -x -s %s | FileCheck %s
+settings show symbols.clang-modules-cache-path
+q
+# This test checks that we get *any* clang modules cache path by default. The
+# actual path depends on the operating system.
+# CHECK: symbols.clang-modules-cache-path (file) = "
+# Clang treats an empty path in the same way as 'no path', so explicitly check
+# that we never have an empty path by default.
+# CHECK-NOT: symbols.clang-modules-cache-path (file) = ""
Index: lldb/source/Core/ModuleList.cpp
===================================================================
--- lldb/source/Core/ModuleList.cpp
+++ lldb/source/Core/ModuleList.cpp
@@ -82,8 +82,9 @@
                                            [this] { UpdateSymlinkMappings(); });
 
   llvm::SmallString<128> path;
-  clang::driver::Driver::getDefaultModuleCachePath(path);
-  SetClangModulesCachePath(path);
+  if (clang::driver::Driver::getDefaultModuleCachePath(path)) {
+    lldbassert(SetClangModulesCachePath(FileSpec(path)));
+  }
 }
 
 bool ModuleListProperties::GetEnableExternalLookup() const {
@@ -104,8 +105,8 @@
       ->GetCurrentValue();
 }
 
-bool ModuleListProperties::SetClangModulesCachePath(llvm::StringRef path) {
-  return m_collection_sp->SetPropertyAtIndexAsString(
+bool ModuleListProperties::SetClangModulesCachePath(const FileSpec &path) {
+  return m_collection_sp->SetPropertyAtIndexAsFileSpec(
       nullptr, ePropertyClangModulesCachePath, path);
 }
 
Index: lldb/include/lldb/Core/ModuleList.h
===================================================================
--- lldb/include/lldb/Core/ModuleList.h
+++ lldb/include/lldb/Core/ModuleList.h
@@ -56,7 +56,7 @@
   ModuleListProperties();
 
   FileSpec GetClangModulesCachePath() const;
-  bool SetClangModulesCachePath(llvm::StringRef path);
+  bool SetClangModulesCachePath(const FileSpec &path);
   bool GetEnableExternalLookup() const;
   bool SetEnableExternalLookup(bool new_value);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92772.310843.patch
Type: text/x-patch
Size: 2791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201210/3ff0e049/attachment.bin>


More information about the lldb-commits mailing list