[Lldb-commits] [lldb] da62f5f - [lldb][DataFormatter][NFC] std::map: Add comments and other minor cleanups

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 3 01:34:43 PDT 2024


Author: Michael Buch
Date: 2024-07-03T10:33:39+02:00
New Revision: da62f5f8dfe4d4196191b40dc41e1ef2de1bf5cb

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

LOG: [lldb][DataFormatter][NFC] std::map: Add comments and other minor cleanups

Added: 
    

Modified: 
    lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index 96d9bcc3f2cd7..2a241e3764b19 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -80,17 +80,10 @@ class MapEntry {
 
 class MapIterator {
 public:
-  MapIterator() = default;
-  MapIterator(MapEntry entry, size_t depth = 0)
-      : m_entry(std::move(entry)), m_max_depth(depth), m_error(false) {}
-  MapIterator(ValueObjectSP entry, size_t depth = 0)
-      : m_entry(std::move(entry)), m_max_depth(depth), m_error(false) {}
-  MapIterator(const MapIterator &rhs)
-      : m_entry(rhs.m_entry), m_max_depth(rhs.m_max_depth), m_error(false) {}
   MapIterator(ValueObject *entry, size_t depth = 0)
       : m_entry(entry), m_max_depth(depth), m_error(false) {}
 
-  MapIterator &operator=(const MapIterator &) = default;
+  MapIterator() = default;
 
   ValueObjectSP value() { return m_entry.GetEntry(); }
 
@@ -108,7 +101,9 @@ class MapIterator {
     return m_entry.GetEntry();
   }
 
-protected:
+private:
+  /// Mimicks libc++'s __tree_next algorithm, which libc++ uses
+  /// in its __tree_iteartor::operator++.
   void next() {
     if (m_entry.null())
       return;
@@ -133,7 +128,7 @@ class MapIterator {
     m_entry = MapEntry(m_entry.parent());
   }
 
-private:
+  /// Mimicks libc++'s __tree_min algorithm.
   MapEntry tree_min(MapEntry x) {
     if (x.null())
       return MapEntry();


        


More information about the lldb-commits mailing list