Inheriting from std::iterator uses more boiler-plate than manual
typedefs. Avoid that in both ilist_iterator and
MachineInstrBundleIterator.
This has the side effect of removing ilist_iterator from certain ADL
lookups in namespace std; calls to std::next need to be qualified by
"std::" that didn't have to before. The one case of this in-tree was
operating on a temporary, so I used the more compact operator++.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280570
91177308-0d34-0410-b5e6-
96231b3b80d8
} // end namespace ilist_detail
/// Iterator for intrusive lists based on ilist_node.
-template <typename NodeTy, bool IsReverse>
-class ilist_iterator
- : public std::iterator<std::bidirectional_iterator_tag, NodeTy, ptrdiff_t> {
+template <typename NodeTy, bool IsReverse> class ilist_iterator {
public:
- typedef std::iterator<std::bidirectional_iterator_tag, NodeTy, ptrdiff_t>
- super;
-
- typedef typename super::value_type value_type;
- typedef typename super::difference_type difference_type;
- typedef typename super::pointer pointer;
- typedef typename super::reference reference;
+ typedef NodeTy value_type;
+ typedef value_type *pointer;
+ typedef value_type &reference;
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
typedef typename std::add_const<value_type>::type *const_pointer;
typedef typename std::add_const<value_type>::type &const_reference;
/// MachineBasicBlock iterator that automatically skips over MIs that are
/// inside bundles (i.e. walk top level MIs only).
-template <typename Ty>
-class MachineInstrBundleIterator
- : public std::iterator<std::bidirectional_iterator_tag, Ty, ptrdiff_t> {
- typedef std::iterator<std::bidirectional_iterator_tag, Ty, ptrdiff_t> super;
+template <typename Ty> class MachineInstrBundleIterator {
typedef ilist_iterator<Ty> instr_iterator;
instr_iterator MII;
public:
- typedef typename super::value_type value_type;
- typedef typename super::difference_type difference_type;
- typedef typename super::pointer pointer;
- typedef typename super::reference reference;
+ typedef typename instr_iterator::value_type value_type;
+ typedef typename instr_iterator::difference_type difference_type;
+ typedef typename instr_iterator::pointer pointer;
+ typedef typename instr_iterator::reference reference;
+ typedef std::bidirectional_iterator_tag iterator_category;
typedef typename instr_iterator::const_pointer const_pointer;
typedef typename instr_iterator::const_reference const_reference;
// Set the insertion point after the last instruction in the bundle. Set the
// debug location to Front.
- Builder.SetInsertPoint(BB, next(BasicBlock::iterator(LastInst)));
+ Builder.SetInsertPoint(BB, ++LastInst->getIterator());
Builder.SetCurrentDebugLocation(Front->getDebugLoc());
}