[llvm] r288285 - Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).

Eugene Zelenko via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 15:10:42 PST 2016


Author: eugenezelenko
Date: Wed Nov 30 17:10:42 2016
New Revision: 288285

URL: http://llvm.org/viewvc/llvm-project?rev=288285&view=rev
Log:
Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).

Modified:
    llvm/trunk/include/llvm/ADT/PostOrderIterator.h
    llvm/trunk/include/llvm/ADT/PriorityWorklist.h
    llvm/trunk/include/llvm/ADT/SCCIterator.h
    llvm/trunk/include/llvm/ADT/SetVector.h
    llvm/trunk/include/llvm/ADT/SmallSet.h

Modified: llvm/trunk/include/llvm/ADT/PostOrderIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PostOrderIterator.h?rev=288285&r1=288284&r2=288285&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PostOrderIterator.h (original)
+++ llvm/trunk/include/llvm/ADT/PostOrderIterator.h Wed Nov 30 17:10:42 2016
@@ -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, SetTy
 // }
 //
 
-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

Modified: llvm/trunk/include/llvm/ADT/PriorityWorklist.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PriorityWorklist.h?rev=288285&r1=288284&r2=288285&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PriorityWorklist.h (original)
+++ llvm/trunk/include/llvm/ADT/PriorityWorklist.h Wed Nov 30 17:10:42 2016
@@ -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

Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SCCIterator.h?rev=288285&r1=288284&r2=288285&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SCCIterator.h (original)
+++ llvm/trunk/include/llvm/ADT/SCCIterator.h Wed Nov 30 17:10:42 2016
@@ -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_fac
   }
 
   /// 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_e
 }
 
 /// \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

Modified: llvm/trunk/include/llvm/ADT/SetVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SetVector.h?rev=288285&r1=288284&r2=288285&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SetVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SetVector.h Wed Nov 30 17:10:42 2016
@@ -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

Modified: llvm/trunk/include/llvm/ADT/SmallSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallSet.h?rev=288285&r1=288284&r2=288285&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallSet.h Wed Nov 30 17:10:42 2016
@@ -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
 
 } // end namespace llvm
 
-#endif
+#endif // LLVM_ADT_SMALLSET_H




More information about the llvm-commits mailing list