[Lldb-commits] [lldb] [WIP][RFC][lldb] faster indexing (PR #122128)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 8 07:35:11 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff fdd7cafb9078e146634a3fbb72a8949108dca425 b534596aa6d7c2c38610d8b32a06ca7a8c6857f5 --extensions cpp,h -- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 1e180e3d29..1c5ce46d92 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -11,6 +11,7 @@
 #include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDeclContext.h"
 #include "Plugins/SymbolFile/DWARF/LogChannelDWARF.h"
+#include "Plugins/SymbolFile/DWARF/NameToDIE.h"
 #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h"
 #include "lldb/Core/DataFileCache.h"
 #include "lldb/Core/Debugger.h"
@@ -21,7 +22,6 @@
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/Timer.h"
-#include "Plugins/SymbolFile/DWARF/NameToDIE.h"
 #include "llvm/Support/ThreadPool.h"
 #include <atomic>
 #include <optional>
@@ -93,7 +93,8 @@ void ManualDWARFIndex::Index() {
   // each unit.
   auto for_each_unit = [&](auto &&fn, auto &&reduce) {
     std::atomic<size_t> next_cu_idx = 0;
-    auto wrapper = [&fn, &next_cu_idx, &units_to_index, &reduce](size_t worker_id) {
+    auto wrapper = [&fn, &next_cu_idx, &units_to_index,
+                    &reduce](size_t worker_id) {
       size_t cu_idx;
       while ((cu_idx = next_cu_idx.fetch_add(1, std::memory_order_relaxed)) <
              units_to_index.size()) {
@@ -603,15 +604,14 @@ enum DataID {
 // index name tables. See DIERef class for details.
 constexpr uint32_t CURRENT_CACHE_VERSION = 2;
 
-template<typename T>
+template <typename T>
 bool ManualDWARFIndex::IndexSet<T>::Decode(const DataExtractor &data,
-                                        lldb::offset_t *offset_ptr) {
+                                           lldb::offset_t *offset_ptr) {
   return true;
 }
 
-template<typename T>
-void ManualDWARFIndex::IndexSet<T>::Encode(DataEncoder &encoder) const {
-}
+template <typename T>
+void ManualDWARFIndex::IndexSet<T>::Encode(DataEncoder &encoder) const {}
 
 bool ManualDWARFIndex::Decode(const DataExtractor &data,
                               lldb::offset_t *offset_ptr,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
index 281ec869a9..8774691f9e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
@@ -59,8 +59,7 @@ public:
   void Dump(Stream &s) override;
 
   // Make IndexSet public so we can unit test the encoding and decoding logic.
-  template<typename T>
-  struct IndexSet {
+  template <typename T> struct IndexSet {
     T function_basenames;
     T function_fullnames;
     T function_methods;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
index 6e8a6b9f9c..bc32447eb7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -64,8 +64,7 @@ void NameToDIE::FindAllEntriesForUnit(
   }
 }
 
-void NameToDIE::Dump(Stream *s) {
-}
+void NameToDIE::Dump(Stream *s) {}
 
 void NameToDIE::ForEach(
     llvm::function_ref<bool(llvm::StringRef name, const DIERef &die_ref)>
@@ -92,8 +91,7 @@ bool NameToDIE::Decode(const DataExtractor &data, lldb::offset_t *offset_ptr,
   return true;
 }
 
-void NameToDIE::Encode(DataEncoder &encoder, ConstStringTable &strtab) const {
-}
+void NameToDIE::Encode(DataEncoder &encoder, ConstStringTable &strtab) const {}
 
 bool NameToDIE::operator==(const NameToDIE &rhs) const {
   return m_map == rhs.m_map;

``````````

</details>


https://github.com/llvm/llvm-project/pull/122128


More information about the lldb-commits mailing list