Skip to content

Commit b6a62a4

Browse files
[ADT] Use range-based for loops in SetVector (NFC) (#154058)
1 parent cbf5af9 commit b6a62a4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/include/llvm/ADT/SetVector.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,8 @@ class SetVector {
313313
bool set_union(const STy &S) {
314314
bool Changed = false;
315315

316-
for (typename STy::const_iterator SI = S.begin(), SE = S.end(); SI != SE;
317-
++SI)
318-
if (insert(*SI))
316+
for (const auto &Elem : S)
317+
if (insert(Elem))
319318
Changed = true;
320319

321320
return Changed;
@@ -326,9 +325,8 @@ class SetVector {
326325
/// SetVector interface is inconsistent with DenseSet.
327326
template <class STy>
328327
void set_subtract(const STy &S) {
329-
for (typename STy::const_iterator SI = S.begin(), SE = S.end(); SI != SE;
330-
++SI)
331-
remove(*SI);
328+
for (const auto &Elem : S)
329+
remove(Elem);
332330
}
333331

334332
void swap(SetVector<T, Vector, Set, N> &RHS) {

0 commit comments

Comments
 (0)