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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288285 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eugene Zelenko 2016-11-30 23:10:42 +00:00
parent 241e6793ec
commit e6159142c4
5 changed files with 45 additions and 28 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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