From: Duncan P. N. Exon Smith Date: Sat, 3 Sep 2016 02:27:35 +0000 (+0000) Subject: ADT: Do not inherit from std::iterator in ilist_iterator X-Git-Tag: android-x86-7.1-r4~27636 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0d65f1da0e11b139d7bc04bddb69bb57a2ad7586;p=android-x86%2Fexternal-llvm.git ADT: Do not inherit from std::iterator in ilist_iterator 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 --- diff --git a/include/llvm/ADT/ilist_iterator.h b/include/llvm/ADT/ilist_iterator.h index 67c9fa79344..d106d0c6221 100644 --- a/include/llvm/ADT/ilist_iterator.h +++ b/include/llvm/ADT/ilist_iterator.h @@ -47,17 +47,13 @@ template <> struct IteratorHelper { } // end namespace ilist_detail /// Iterator for intrusive lists based on ilist_node. -template -class ilist_iterator - : public std::iterator { +template class ilist_iterator { public: - typedef std::iterator - 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::type *const_pointer; typedef typename std::add_const::type &const_reference; diff --git a/include/llvm/CodeGen/MachineInstrBundleIterator.h b/include/llvm/CodeGen/MachineInstrBundleIterator.h index f493dbc5e36..ac09d26a439 100644 --- a/include/llvm/CodeGen/MachineInstrBundleIterator.h +++ b/include/llvm/CodeGen/MachineInstrBundleIterator.h @@ -21,18 +21,16 @@ namespace llvm { /// MachineBasicBlock iterator that automatically skips over MIs that are /// inside bundles (i.e. walk top level MIs only). -template -class MachineInstrBundleIterator - : public std::iterator { - typedef std::iterator super; +template class MachineInstrBundleIterator { typedef ilist_iterator 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; diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 39d5294c0d4..6dabfca72de 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -2226,7 +2226,7 @@ void BoUpSLP::setInsertPointAfterBundle(ArrayRef VL) { // 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()); }