[PATCH] D83939: Remove deprecated std::iterator

Matthew Parkinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 03:55:44 PDT 2020


mjp41 created this revision.
mjp41 added reviewers: rengolin, chandlerc.
mjp41 added a project: LLVM.
Herald added subscribers: llvm-commits, asbirlea, dexonsmith, george.burgess.iv.

In C++17 std::iterator is deprecated, this removes the use.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83939

Files:
  llvm/include/llvm/ADT/iterator.h
  llvm/include/llvm/Analysis/MemorySSA.h


Index: llvm/include/llvm/Analysis/MemorySSA.h
===================================================================
--- llvm/include/llvm/Analysis/MemorySSA.h
+++ llvm/include/llvm/Analysis/MemorySSA.h
@@ -1102,7 +1102,7 @@
     return MP->getIncomingBlock(ArgNo);
   }
 
-  typename BaseT::iterator::pointer operator*() const {
+  typename BaseT::pointer operator*() const {
     assert(Access && "Tried to access past the end of our iterator");
     // Go to the first argument for phis, and the defining access for everything
     // else.
@@ -1196,7 +1196,7 @@
     return DefIterator == Other.DefIterator;
   }
 
-  BaseT::iterator::reference operator*() const {
+  BaseT::reference operator*() const {
     assert(DefIterator != OriginalAccess->defs_end() &&
            "Tried to access past the end of our iterator");
     return CurrentPair;
Index: llvm/include/llvm/ADT/iterator.h
===================================================================
--- llvm/include/llvm/ADT/iterator.h
+++ llvm/include/llvm/ADT/iterator.h
@@ -64,9 +64,15 @@
 template <typename DerivedT, typename IteratorCategoryT, typename T,
           typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *,
           typename ReferenceT = T &>
-class iterator_facade_base
-    : public std::iterator<IteratorCategoryT, T, DifferenceTypeT, PointerT,
-                           ReferenceT> {
+class iterator_facade_base {
+
+public:
+  typedef T value_type;
+  typedef PointerT pointer;
+  typedef ReferenceT reference;
+  typedef DifferenceTypeT difference_type;
+  typedef IteratorCategoryT iterator_category;
+
 protected:
   enum {
     IsRandomAccess = std::is_base_of<std::random_access_iterator_tag,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83939.278418.patch
Type: text/x-patch
Size: 1699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200716/7445806d/attachment.bin>


More information about the llvm-commits mailing list