diff options
| author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-11-30 23:10:42 +0000 |
|---|---|---|
| committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-11-30 23:10:42 +0000 |
| commit | 8069677ad214f4e923173ad1f6ed69794dde429f (patch) | |
| tree | 494341877892ccfffdf31ae00b987adde03c6c5d | |
| parent | 61a8e53bf3d78c7733b5a7ba772c9b7199d0d5cb (diff) | |
| download | bcm5719-llvm-8069677ad214f4e923173ad1f6ed69794dde429f.tar.gz bcm5719-llvm-8069677ad214f4e923173ad1f6ed69794dde429f.zip | |
Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 288285
| -rw-r--r-- | llvm/include/llvm/ADT/PostOrderIterator.h | 20 | ||||
| -rw-r--r-- | llvm/include/llvm/ADT/PriorityWorklist.h | 11 | ||||
| -rw-r--r-- | llvm/include/llvm/ADT/SCCIterator.h | 17 | ||||
| -rw-r--r-- | llvm/include/llvm/ADT/SetVector.h | 14 | ||||
| -rw-r--r-- | llvm/include/llvm/ADT/SmallSet.h | 11 |
5 files changed, 45 insertions, 28 deletions
diff --git a/llvm/include/llvm/ADT/PostOrderIterator.h b/llvm/include/llvm/ADT/PostOrderIterator.h index ae72776076a..e519b5c0796 100644 --- a/llvm/include/llvm/ADT/PostOrderIterator.h +++ b/llvm/include/llvm/ADT/PostOrderIterator.h @@ -17,10 +17,12 @@ #define LLVM_ADT_POSTORDERITERATOR_H #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/iterator_range.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/SmallPtrSet.h" +#include <iterator> #include <set> +#include <utility> #include <vector> namespace llvm { @@ -55,6 +57,7 @@ namespace llvm { template<class SetType, bool External> class po_iterator_storage { SetType Visited; + public: // Return true if edge destination should be visited. template <typename NodeRef> @@ -70,6 +73,7 @@ public: template<class SetType> class po_iterator_storage<SetType, true> { SetType &Visited; + public: po_iterator_storage(SetType &VSet) : Visited(VSet) {} po_iterator_storage(const po_iterator_storage &S) : Visited(S.Visited) {} @@ -87,7 +91,7 @@ public: template <class GraphT, class SetType = - llvm::SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>, + SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>, bool ExtStorage = false, class GT = GraphTraits<GraphT>> class po_iterator : public std::iterator<std::forward_iterator_tag, typename GT::NodeRef>, @@ -115,7 +119,8 @@ class po_iterator VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB))); traverseChild(); } - po_iterator() {} // End is when stack is empty. + + po_iterator() = default; // End is when stack is empty. po_iterator(NodeRef BB, SetType &S) : po_iterator_storage<SetType, ExtStorage>(S) { @@ -128,6 +133,7 @@ class po_iterator po_iterator(SetType &S) : po_iterator_storage<SetType, ExtStorage>(S) { } // End is when stack is empty. + public: typedef typename super::pointer pointer; @@ -274,13 +280,15 @@ inverse_post_order_ext(const T &G, SetType &S) { // } // -template<class GraphT, class GT = GraphTraits<GraphT> > +template<class GraphT, class GT = GraphTraits<GraphT>> class ReversePostOrderTraversal { typedef typename GT::NodeRef NodeRef; std::vector<NodeRef> Blocks; // Block list in normal PO order + void Initialize(NodeRef BB) { std::copy(po_begin(BB), po_end(BB), std::back_inserter(Blocks)); } + public: typedef typename std::vector<NodeRef>::reverse_iterator rpo_iterator; @@ -291,6 +299,6 @@ public: rpo_iterator end() { return Blocks.rend(); } }; -} // End llvm namespace +} // end namespace llvm -#endif +#endif // LLVM_ADT_POSTORDERITERATOR_H diff --git a/llvm/include/llvm/ADT/PriorityWorklist.h b/llvm/include/llvm/ADT/PriorityWorklist.h index 511606b1fd8..c0b4709e98f 100644 --- a/llvm/include/llvm/ADT/PriorityWorklist.h +++ b/llvm/include/llvm/ADT/PriorityWorklist.h @@ -19,9 +19,10 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/Compiler.h" #include <algorithm> #include <cassert> -#include <utility> +#include <cstddef> #include <vector> namespace llvm { @@ -60,7 +61,7 @@ public: typedef typename MapT::size_type size_type; /// Construct an empty PriorityWorklist - PriorityWorklist() {} + PriorityWorklist() = default; /// Determine if the PriorityWorklist is empty or not. bool empty() const { @@ -217,9 +218,9 @@ class SmallPriorityWorklist : public PriorityWorklist<T, SmallVector<T, N>, SmallDenseMap<T, ptrdiff_t>> { public: - SmallPriorityWorklist() {} + SmallPriorityWorklist() = default; }; -} +} // end namespace llvm -#endif +#endif // LLVM_ADT_PRIORITYWORKLIST_H diff --git a/llvm/include/llvm/ADT/SCCIterator.h b/llvm/include/llvm/ADT/SCCIterator.h index e89345c0f34..9a8a7b168fc 100644 --- a/llvm/include/llvm/ADT/SCCIterator.h +++ b/llvm/include/llvm/ADT/SCCIterator.h @@ -26,6 +26,9 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator.h" +#include <cassert> +#include <cstddef> +#include <iterator> #include <vector> namespace llvm { @@ -93,7 +96,7 @@ class scc_iterator : public iterator_facade_base< } /// End is when the DFS stack is empty. - scc_iterator() {} + scc_iterator() = default; public: static scc_iterator begin(const GraphT &G) { @@ -230,15 +233,15 @@ template <class T> scc_iterator<T> scc_end(const T &G) { } /// \brief Construct the begin iterator for a deduced graph type T's Inverse<T>. -template <class T> scc_iterator<Inverse<T> > scc_begin(const Inverse<T> &G) { - return scc_iterator<Inverse<T> >::begin(G); +template <class T> scc_iterator<Inverse<T>> scc_begin(const Inverse<T> &G) { + return scc_iterator<Inverse<T>>::begin(G); } /// \brief Construct the end iterator for a deduced graph type T's Inverse<T>. -template <class T> scc_iterator<Inverse<T> > scc_end(const Inverse<T> &G) { - return scc_iterator<Inverse<T> >::end(G); +template <class T> scc_iterator<Inverse<T>> scc_end(const Inverse<T> &G) { + return scc_iterator<Inverse<T>>::end(G); } -} // End llvm namespace +} // end namespace llvm -#endif +#endif // LLVM_ADT_SCCITERATOR_H diff --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h index c6bc9bfb546..98b64764e52 100644 --- a/llvm/include/llvm/ADT/SetVector.h +++ b/llvm/include/llvm/ADT/SetVector.h @@ -20,12 +20,13 @@ #ifndef LLVM_ADT_SETVECTOR_H #define LLVM_ADT_SETVECTOR_H +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallSet.h" +#include "llvm/Support/Compiler.h" #include <algorithm> #include <cassert> -#include <utility> +#include <iterator> #include <vector> namespace llvm { @@ -52,7 +53,7 @@ public: typedef typename vector_type::size_type size_type; /// \brief Construct an empty SetVector - SetVector() {} + SetVector() = default; /// \brief Initialize a SetVector with a range of elements template<typename It> @@ -285,7 +286,7 @@ template <typename T, unsigned N> class SmallSetVector : public SetVector<T, SmallVector<T, N>, SmallDenseSet<T, N>> { public: - SmallSetVector() {} + SmallSetVector() = default; /// \brief Initialize a SmallSetVector with a range of elements template<typename It> @@ -294,7 +295,6 @@ public: } }; -} // End llvm namespace +} // end namespace llvm -// vim: sw=2 ai -#endif +#endif // LLVM_ADT_SETVECTOR_H diff --git a/llvm/include/llvm/ADT/SmallSet.h b/llvm/include/llvm/ADT/SmallSet.h index 07bdf0c33df..6dac1677b7a 100644 --- a/llvm/include/llvm/ADT/SmallSet.h +++ b/llvm/include/llvm/ADT/SmallSet.h @@ -17,7 +17,11 @@ #include "llvm/ADT/None.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/Compiler.h" +#include <cstddef> +#include <functional> #include <set> +#include <utility> namespace llvm { @@ -28,7 +32,7 @@ namespace llvm { /// /// Note that this set does not provide a way to iterate over members in the /// set. -template <typename T, unsigned N, typename C = std::less<T> > +template <typename T, unsigned N, typename C = std::less<T>> class SmallSet { /// Use a SmallVector to hold the elements here (even though it will never /// reach its 'large' stage) to avoid calling the default ctors of elements @@ -45,7 +49,8 @@ class SmallSet { public: typedef size_t size_type; - SmallSet() {} + + SmallSet() = default; LLVM_NODISCARD bool empty() const { return Vector.empty() && Set.empty(); @@ -133,4 +138,4 @@ class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {}; } // end namespace llvm -#endif +#endif // LLVM_ADT_SMALLSET_H |

