Skip to content

Commit 29f4a05

Browse files
committed
[SetOperations] clang-format header (NFC)
This header used three-space indentation in a number of places. Reformat it completely.
1 parent 16d02cd commit 29f4a05

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

llvm/include/llvm/ADT/SetOperations.h

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ namespace llvm {
1919

2020
/// set_union(A, B) - Compute A := A u B, return whether A changed.
2121
///
22-
template <class S1Ty, class S2Ty>
23-
bool set_union(S1Ty &S1, const S2Ty &S2) {
22+
template <class S1Ty, class S2Ty> bool set_union(S1Ty &S1, const S2Ty &S2) {
2423
bool Changed = false;
2524

26-
for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
27-
SI != SE; ++SI)
25+
for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); SI != SE;
26+
++SI)
2827
if (S1.insert(*SI).second)
2928
Changed = true;
3029

@@ -36,52 +35,51 @@ bool set_union(S1Ty &S1, const S2Ty &S2) {
3635
/// is nicer to use. Functionally, this iterates through S1, removing
3736
/// elements that are not contained in S2.
3837
///
39-
template <class S1Ty, class S2Ty>
40-
void set_intersect(S1Ty &S1, const S2Ty &S2) {
41-
for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
42-
const auto &E = *I;
43-
++I;
44-
if (!S2.count(E)) S1.erase(E); // Erase element if not in S2
45-
}
38+
template <class S1Ty, class S2Ty> void set_intersect(S1Ty &S1, const S2Ty &S2) {
39+
for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
40+
const auto &E = *I;
41+
++I;
42+
if (!S2.count(E))
43+
S1.erase(E); // Erase element if not in S2
44+
}
4645
}
4746

4847
template <class S1Ty, class S2Ty>
4948
S1Ty set_intersection_impl(const S1Ty &S1, const S2Ty &S2) {
50-
S1Ty Result;
51-
for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end(); SI != SE;
52-
++SI)
53-
if (S2.count(*SI))
49+
S1Ty Result;
50+
for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end(); SI != SE;
51+
++SI)
52+
if (S2.count(*SI))
5453
Result.insert(*SI);
55-
return Result;
54+
return Result;
5655
}
5756

5857
/// set_intersection(A, B) - Return A ^ B
5958
template <class S1Ty, class S2Ty>
6059
S1Ty set_intersection(const S1Ty &S1, const S2Ty &S2) {
61-
if (S1.size() < S2.size())
62-
return set_intersection_impl(S1, S2);
63-
else
64-
return set_intersection_impl(S2, S1);
60+
if (S1.size() < S2.size())
61+
return set_intersection_impl(S1, S2);
62+
else
63+
return set_intersection_impl(S2, S1);
6564
}
6665

6766
/// set_difference(A, B) - Return A - B
6867
///
6968
template <class S1Ty, class S2Ty>
7069
S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) {
7170
S1Ty Result;
72-
for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end();
73-
SI != SE; ++SI)
74-
if (!S2.count(*SI)) // if the element is not in set2
71+
for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end(); SI != SE;
72+
++SI)
73+
if (!S2.count(*SI)) // if the element is not in set2
7574
Result.insert(*SI);
7675
return Result;
7776
}
7877

7978
/// set_subtract(A, B) - Compute A := A - B
8079
///
81-
template <class S1Ty, class S2Ty>
82-
void set_subtract(S1Ty &S1, const S2Ty &S2) {
83-
for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
84-
SI != SE; ++SI)
80+
template <class S1Ty, class S2Ty> void set_subtract(S1Ty &S1, const S2Ty &S2) {
81+
for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); SI != SE;
82+
++SI)
8583
S1.erase(*SI);
8684
}
8785

@@ -110,6 +108,6 @@ bool set_is_subset(const S1Ty &S1, const S2Ty &S2) {
110108
return true;
111109
}
112110

113-
} // End llvm namespace
111+
} // namespace llvm
114112

115113
#endif

0 commit comments

Comments
 (0)