[llvm] 29f4a05 - [SetOperations] clang-format header (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 02:20:37 PDT 2024
Author: Nikita Popov
Date: 2024-06-25T11:20:24+02:00
New Revision: 29f4a0561a03f4760a876e39d443c64ea7ee9e22
URL: https://github.com/llvm/llvm-project/commit/29f4a0561a03f4760a876e39d443c64ea7ee9e22
DIFF: https://github.com/llvm/llvm-project/commit/29f4a0561a03f4760a876e39d443c64ea7ee9e22.diff
LOG: [SetOperations] clang-format header (NFC)
This header used three-space indentation in a number of places.
Reformat it completely.
Added:
Modified:
llvm/include/llvm/ADT/SetOperations.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/SetOperations.h b/llvm/include/llvm/ADT/SetOperations.h
index 52aced7068931..6c04c764e5207 100644
--- a/llvm/include/llvm/ADT/SetOperations.h
+++ b/llvm/include/llvm/ADT/SetOperations.h
@@ -19,12 +19,11 @@ namespace llvm {
/// set_union(A, B) - Compute A := A u B, return whether A changed.
///
-template <class S1Ty, class S2Ty>
-bool set_union(S1Ty &S1, const S2Ty &S2) {
+template <class S1Ty, class S2Ty> bool set_union(S1Ty &S1, const S2Ty &S2) {
bool Changed = false;
- for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
- SI != SE; ++SI)
+ for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); SI != SE;
+ ++SI)
if (S1.insert(*SI).second)
Changed = true;
@@ -36,32 +35,32 @@ bool set_union(S1Ty &S1, const S2Ty &S2) {
/// is nicer to use. Functionally, this iterates through S1, removing
/// elements that are not contained in S2.
///
-template <class S1Ty, class S2Ty>
-void set_intersect(S1Ty &S1, const S2Ty &S2) {
- for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
- const auto &E = *I;
- ++I;
- if (!S2.count(E)) S1.erase(E); // Erase element if not in S2
- }
+template <class S1Ty, class S2Ty> void set_intersect(S1Ty &S1, const S2Ty &S2) {
+ for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
+ const auto &E = *I;
+ ++I;
+ if (!S2.count(E))
+ S1.erase(E); // Erase element if not in S2
+ }
}
template <class S1Ty, class S2Ty>
S1Ty set_intersection_impl(const S1Ty &S1, const S2Ty &S2) {
- S1Ty Result;
- for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end(); SI != SE;
- ++SI)
- if (S2.count(*SI))
+ S1Ty Result;
+ for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end(); SI != SE;
+ ++SI)
+ if (S2.count(*SI))
Result.insert(*SI);
- return Result;
+ return Result;
}
/// set_intersection(A, B) - Return A ^ B
template <class S1Ty, class S2Ty>
S1Ty set_intersection(const S1Ty &S1, const S2Ty &S2) {
- if (S1.size() < S2.size())
- return set_intersection_impl(S1, S2);
- else
- return set_intersection_impl(S2, S1);
+ if (S1.size() < S2.size())
+ return set_intersection_impl(S1, S2);
+ else
+ return set_intersection_impl(S2, S1);
}
/// set_
diff erence(A, B) - Return A - B
@@ -69,19 +68,18 @@ S1Ty set_intersection(const S1Ty &S1, const S2Ty &S2) {
template <class S1Ty, class S2Ty>
S1Ty set_
diff erence(const S1Ty &S1, const S2Ty &S2) {
S1Ty Result;
- for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end();
- SI != SE; ++SI)
- if (!S2.count(*SI)) // if the element is not in set2
+ for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end(); SI != SE;
+ ++SI)
+ if (!S2.count(*SI)) // if the element is not in set2
Result.insert(*SI);
return Result;
}
/// set_subtract(A, B) - Compute A := A - B
///
-template <class S1Ty, class S2Ty>
-void set_subtract(S1Ty &S1, const S2Ty &S2) {
- for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
- SI != SE; ++SI)
+template <class S1Ty, class S2Ty> void set_subtract(S1Ty &S1, const S2Ty &S2) {
+ for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); SI != SE;
+ ++SI)
S1.erase(*SI);
}
@@ -110,6 +108,6 @@ bool set_is_subset(const S1Ty &S1, const S2Ty &S2) {
return true;
}
-} // End llvm namespace
+} // namespace llvm
#endif
More information about the llvm-commits
mailing list