[PATCH] D133650: [BOLT] Stop using std::iterator (NFC)
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 13 14:14:35 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG588628de3e95: [BOLT] Stop using std::iterator (NFC) (authored by kazu).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133650/new/
https://reviews.llvm.org/D133650
Files:
bolt/include/bolt/Core/BinaryContext.h
bolt/include/bolt/Core/MCPlusBuilder.h
bolt/include/bolt/Passes/DataflowAnalysis.h
Index: bolt/include/bolt/Passes/DataflowAnalysis.h
===================================================================
--- bolt/include/bolt/Passes/DataflowAnalysis.h
+++ bolt/include/bolt/Passes/DataflowAnalysis.h
@@ -439,13 +439,18 @@
/// Define an iterator for navigating the expressions calculated by a
/// dataflow analysis at each program point, when they are backed by a
/// BitVector.
-class ExprIterator
- : public std::iterator<std::forward_iterator_tag, const MCInst *> {
+class ExprIterator {
const BitVector *BV;
const std::vector<MCInst *> &Expressions;
int Idx;
public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = const MCInst *;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type *;
+ using reference = value_type &;
+
ExprIterator &operator++() {
assert(Idx != -1 && "Iterator already at the end");
Idx = BV->find_next(Idx);
Index: bolt/include/bolt/Core/MCPlusBuilder.h
===================================================================
--- bolt/include/bolt/Core/MCPlusBuilder.h
+++ bolt/include/bolt/Core/MCPlusBuilder.h
@@ -164,9 +164,14 @@
void setTailCall(MCInst &Inst);
public:
- class InstructionIterator
- : public std::iterator<std::bidirectional_iterator_tag, MCInst> {
+ class InstructionIterator {
public:
+ using iterator_category = std::bidirectional_iterator_tag;
+ using value_type = MCInst;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type *;
+ using reference = value_type &;
+
class Impl {
public:
virtual Impl *Copy() const = 0;
Index: bolt/include/bolt/Core/BinaryContext.h
===================================================================
--- bolt/include/bolt/Core/BinaryContext.h
+++ bolt/include/bolt/Core/BinaryContext.h
@@ -104,9 +104,8 @@
/// Filter iterator.
template <typename ItrType,
typename PredType = std::function<bool(const ItrType &)>>
-class FilterIterator
- : public std::iterator<std::bidirectional_iterator_tag,
- typename std::iterator_traits<ItrType>::value_type> {
+class FilterIterator {
+ using inner_traits = std::iterator_traits<ItrType>;
using Iterator = FilterIterator;
using T = typename std::iterator_traits<ItrType>::reference;
using PointerT = typename std::iterator_traits<ItrType>::pointer;
@@ -128,6 +127,12 @@
}
public:
+ using iterator_category = std::bidirectional_iterator_tag;
+ using value_type = typename inner_traits::value_type;
+ using difference_type = typename inner_traits::difference_type;
+ using pointer = typename inner_traits::pointer;
+ using reference = typename inner_traits::reference;
+
Iterator &operator++() { next(); return *this; }
Iterator &operator--() { prev(); return *this; }
Iterator operator++(int) { auto Tmp(Itr); next(); return Tmp; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133650.459871.patch
Type: text/x-patch
Size: 2881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220913/e1ca27f0/attachment.bin>
More information about the llvm-commits
mailing list