[Lldb-commits] [lldb] a314a36 - [lldb] Fix deprecation warning for using std::iterator

Nico Weber via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 30 07:19:25 PDT 2022


Author: Nico Weber
Date: 2022-09-30T10:19:08-04:00
New Revision: a314a36aaa1d3bb27a2102820ff636f7cd0940eb

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

LOG: [lldb] Fix deprecation warning for using std::iterator

std::iterator was deprecated in C++17.

No behavior change.

Differential Revision: https://reviews.llvm.org/D134844

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index e1d0efa844c34..e8492079af88a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -14,6 +14,8 @@
 #include "DWARFDeclContext.h"
 #include "DWARFUnit.h"
 
+#include "llvm/ADT/iterator.h"
+
 using namespace lldb_private;
 using namespace lldb_private::dwarf;
 
@@ -24,7 +26,9 @@ namespace {
 /// convenience, the starting die is included in the sequence as the first
 /// item.
 class ElaboratingDIEIterator
-    : public std::iterator<std::input_iterator_tag, DWARFDIE> {
+    : public llvm::iterator_facade_base<
+          ElaboratingDIEIterator, std::input_iterator_tag, DWARFDIE,
+          std::ptr
diff _t, DWARFDIE *, DWARFDIE *> {
 
   // The operating invariant is: top of m_worklist contains the "current" item
   // and the rest of the list are items yet to be visited. An empty worklist
@@ -62,11 +66,6 @@ class ElaboratingDIEIterator
     Next();
     return *this;
   }
-  ElaboratingDIEIterator operator++(int) {
-    ElaboratingDIEIterator I = *this;
-    Next();
-    return I;
-  }
 
   friend bool operator==(const ElaboratingDIEIterator &a,
                          const ElaboratingDIEIterator &b) {
@@ -74,10 +73,6 @@ class ElaboratingDIEIterator
       return a.m_worklist.empty() == b.m_worklist.empty();
     return a.m_worklist.back() == b.m_worklist.back();
   }
-  friend bool operator!=(const ElaboratingDIEIterator &a,
-                         const ElaboratingDIEIterator &b) {
-    return !(a == b);
-  }
 };
 
 llvm::iterator_range<ElaboratingDIEIterator>


        


More information about the lldb-commits mailing list