[llvm] [ADT] Use range-based for loops in SetVector (NFC) (PR #154058)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 17 21:25:05 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/154058.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/SetVector.h (+4-6)
``````````diff
diff --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h
index 0692071adb391..85d4f2d5ee28a 100644
--- a/llvm/include/llvm/ADT/SetVector.h
+++ b/llvm/include/llvm/ADT/SetVector.h
@@ -313,9 +313,8 @@ class SetVector {
bool set_union(const STy &S) {
bool Changed = false;
- for (typename STy::const_iterator SI = S.begin(), SE = S.end(); SI != SE;
- ++SI)
- if (insert(*SI))
+ for (const auto &Elem : S)
+ if (insert(Elem))
Changed = true;
return Changed;
@@ -326,9 +325,8 @@ class SetVector {
/// SetVector interface is inconsistent with DenseSet.
template <class STy>
void set_subtract(const STy &S) {
- for (typename STy::const_iterator SI = S.begin(), SE = S.end(); SI != SE;
- ++SI)
- remove(*SI);
+ for (const auto &Elem : S)
+ remove(Elem);
}
void swap(SetVector<T, Vector, Set, N> &RHS) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/154058
More information about the llvm-commits
mailing list