Skip to content

Commit 8069677

Browse files
committed
Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 288285
1 parent 61a8e53 commit 8069677

File tree

5 files changed

+45
-28
lines changed

5 files changed

+45
-28
lines changed

llvm/include/llvm/ADT/PostOrderIterator.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
#define LLVM_ADT_POSTORDERITERATOR_H
1818

1919
#include "llvm/ADT/GraphTraits.h"
20-
#include "llvm/ADT/SmallPtrSet.h"
2120
#include "llvm/ADT/iterator_range.h"
2221
#include "llvm/ADT/Optional.h"
22+
#include "llvm/ADT/SmallPtrSet.h"
23+
#include <iterator>
2324
#include <set>
25+
#include <utility>
2426
#include <vector>
2527

2628
namespace llvm {
@@ -55,6 +57,7 @@ namespace llvm {
5557
template<class SetType, bool External>
5658
class po_iterator_storage {
5759
SetType Visited;
60+
5861
public:
5962
// Return true if edge destination should be visited.
6063
template <typename NodeRef>
@@ -70,6 +73,7 @@ class po_iterator_storage {
7073
template<class SetType>
7174
class po_iterator_storage<SetType, true> {
7275
SetType &Visited;
76+
7377
public:
7478
po_iterator_storage(SetType &VSet) : Visited(VSet) {}
7579
po_iterator_storage(const po_iterator_storage &S) : Visited(S.Visited) {}
@@ -87,7 +91,7 @@ class po_iterator_storage<SetType, true> {
8791

8892
template <class GraphT,
8993
class SetType =
90-
llvm::SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>,
94+
SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>,
9195
bool ExtStorage = false, class GT = GraphTraits<GraphT>>
9296
class po_iterator
9397
: public std::iterator<std::forward_iterator_tag, typename GT::NodeRef>,
@@ -115,7 +119,8 @@ class po_iterator
115119
VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
116120
traverseChild();
117121
}
118-
po_iterator() {} // End is when stack is empty.
122+
123+
po_iterator() = default; // End is when stack is empty.
119124

120125
po_iterator(NodeRef BB, SetType &S)
121126
: po_iterator_storage<SetType, ExtStorage>(S) {
@@ -128,6 +133,7 @@ class po_iterator
128133
po_iterator(SetType &S)
129134
: po_iterator_storage<SetType, ExtStorage>(S) {
130135
} // End is when stack is empty.
136+
131137
public:
132138
typedef typename super::pointer pointer;
133139

@@ -274,13 +280,15 @@ inverse_post_order_ext(const T &G, SetType &S) {
274280
// }
275281
//
276282

277-
template<class GraphT, class GT = GraphTraits<GraphT> >
283+
template<class GraphT, class GT = GraphTraits<GraphT>>
278284
class ReversePostOrderTraversal {
279285
typedef typename GT::NodeRef NodeRef;
280286
std::vector<NodeRef> Blocks; // Block list in normal PO order
287+
281288
void Initialize(NodeRef BB) {
282289
std::copy(po_begin(BB), po_end(BB), std::back_inserter(Blocks));
283290
}
291+
284292
public:
285293
typedef typename std::vector<NodeRef>::reverse_iterator rpo_iterator;
286294

@@ -291,6 +299,6 @@ class ReversePostOrderTraversal {
291299
rpo_iterator end() { return Blocks.rend(); }
292300
};
293301

294-
} // End llvm namespace
302+
} // end namespace llvm
295303

296-
#endif
304+
#endif // LLVM_ADT_POSTORDERITERATOR_H

llvm/include/llvm/ADT/PriorityWorklist.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
#include "llvm/ADT/DenseMap.h"
2020
#include "llvm/ADT/STLExtras.h"
2121
#include "llvm/ADT/SmallVector.h"
22+
#include "llvm/Support/Compiler.h"
2223
#include <algorithm>
2324
#include <cassert>
24-
#include <utility>
25+
#include <cstddef>
2526
#include <vector>
2627

2728
namespace llvm {
@@ -60,7 +61,7 @@ class PriorityWorklist {
6061
typedef typename MapT::size_type size_type;
6162

6263
/// Construct an empty PriorityWorklist
63-
PriorityWorklist() {}
64+
PriorityWorklist() = default;
6465

6566
/// Determine if the PriorityWorklist is empty or not.
6667
bool empty() const {
@@ -217,9 +218,9 @@ class SmallPriorityWorklist
217218
: public PriorityWorklist<T, SmallVector<T, N>,
218219
SmallDenseMap<T, ptrdiff_t>> {
219220
public:
220-
SmallPriorityWorklist() {}
221+
SmallPriorityWorklist() = default;
221222
};
222223

223-
}
224+
} // end namespace llvm
224225

225-
#endif
226+
#endif // LLVM_ADT_PRIORITYWORKLIST_H

llvm/include/llvm/ADT/SCCIterator.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "llvm/ADT/DenseMap.h"
2727
#include "llvm/ADT/GraphTraits.h"
2828
#include "llvm/ADT/iterator.h"
29+
#include <cassert>
30+
#include <cstddef>
31+
#include <iterator>
2932
#include <vector>
3033

3134
namespace llvm {
@@ -93,7 +96,7 @@ class scc_iterator : public iterator_facade_base<
9396
}
9497

9598
/// End is when the DFS stack is empty.
96-
scc_iterator() {}
99+
scc_iterator() = default;
97100

98101
public:
99102
static scc_iterator begin(const GraphT &G) {
@@ -230,15 +233,15 @@ template <class T> scc_iterator<T> scc_end(const T &G) {
230233
}
231234

232235
/// \brief Construct the begin iterator for a deduced graph type T's Inverse<T>.
233-
template <class T> scc_iterator<Inverse<T> > scc_begin(const Inverse<T> &G) {
234-
return scc_iterator<Inverse<T> >::begin(G);
236+
template <class T> scc_iterator<Inverse<T>> scc_begin(const Inverse<T> &G) {
237+
return scc_iterator<Inverse<T>>::begin(G);
235238
}
236239

237240
/// \brief Construct the end iterator for a deduced graph type T's Inverse<T>.
238-
template <class T> scc_iterator<Inverse<T> > scc_end(const Inverse<T> &G) {
239-
return scc_iterator<Inverse<T> >::end(G);
241+
template <class T> scc_iterator<Inverse<T>> scc_end(const Inverse<T> &G) {
242+
return scc_iterator<Inverse<T>>::end(G);
240243
}
241244

242-
} // End llvm namespace
245+
} // end namespace llvm
243246

244-
#endif
247+
#endif // LLVM_ADT_SCCITERATOR_H

llvm/include/llvm/ADT/SetVector.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
#ifndef LLVM_ADT_SETVECTOR_H
2121
#define LLVM_ADT_SETVECTOR_H
2222

23+
#include "llvm/ADT/ArrayRef.h"
2324
#include "llvm/ADT/DenseSet.h"
2425
#include "llvm/ADT/STLExtras.h"
25-
#include "llvm/ADT/SmallSet.h"
26+
#include "llvm/Support/Compiler.h"
2627
#include <algorithm>
2728
#include <cassert>
28-
#include <utility>
29+
#include <iterator>
2930
#include <vector>
3031

3132
namespace llvm {
@@ -52,7 +53,7 @@ class SetVector {
5253
typedef typename vector_type::size_type size_type;
5354

5455
/// \brief Construct an empty SetVector
55-
SetVector() {}
56+
SetVector() = default;
5657

5758
/// \brief Initialize a SetVector with a range of elements
5859
template<typename It>
@@ -285,7 +286,7 @@ template <typename T, unsigned N>
285286
class SmallSetVector
286287
: public SetVector<T, SmallVector<T, N>, SmallDenseSet<T, N>> {
287288
public:
288-
SmallSetVector() {}
289+
SmallSetVector() = default;
289290

290291
/// \brief Initialize a SmallSetVector with a range of elements
291292
template<typename It>
@@ -294,7 +295,6 @@ class SmallSetVector
294295
}
295296
};
296297

297-
} // End llvm namespace
298+
} // end namespace llvm
298299

299-
// vim: sw=2 ai
300-
#endif
300+
#endif // LLVM_ADT_SETVECTOR_H

llvm/include/llvm/ADT/SmallSet.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
#include "llvm/ADT/None.h"
1818
#include "llvm/ADT/SmallPtrSet.h"
1919
#include "llvm/ADT/SmallVector.h"
20+
#include "llvm/Support/Compiler.h"
21+
#include <cstddef>
22+
#include <functional>
2023
#include <set>
24+
#include <utility>
2125

2226
namespace llvm {
2327

@@ -28,7 +32,7 @@ namespace llvm {
2832
///
2933
/// Note that this set does not provide a way to iterate over members in the
3034
/// set.
31-
template <typename T, unsigned N, typename C = std::less<T> >
35+
template <typename T, unsigned N, typename C = std::less<T>>
3236
class SmallSet {
3337
/// Use a SmallVector to hold the elements here (even though it will never
3438
/// reach its 'large' stage) to avoid calling the default ctors of elements
@@ -45,7 +49,8 @@ class SmallSet {
4549

4650
public:
4751
typedef size_t size_type;
48-
SmallSet() {}
52+
53+
SmallSet() = default;
4954

5055
LLVM_NODISCARD bool empty() const {
5156
return Vector.empty() && Set.empty();
@@ -133,4 +138,4 @@ class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {};
133138

134139
} // end namespace llvm
135140

136-
#endif
141+
#endif // LLVM_ADT_SMALLSET_H

0 commit comments

Comments
 (0)