15#ifndef LLVM_ADT_SETOPERATIONS_H
16#define LLVM_ADT_SETOPERATIONS_H
23template <
typename Set,
typename Fn>
25 decltype(std::declval<Set>().remove_if(std::declval<Fn>()));
27template <
typename Set,
typename Fn>
31template <
typename Set>
33 decltype(std::declval<Set>().erase(std::declval<Set>().begin()));
35template <
typename Set>
43template <
class S1Ty,
class S2Ty>
bool set_union(S1Ty &
S1,
const S2Ty &S2) {
46 for (
const auto &
E : S2)
47 if (
S1.insert(
E).second)
59 auto Pred = [&S2](
const auto &
E) {
return !S2.count(
E); };
63 typename S1Ty::iterator Next;
64 for (
typename S1Ty::iterator
I =
S1.begin();
I !=
S1.end();
I = Next) {
72template <
class S1Ty,
class S2Ty>
75 for (
const auto &
E :
S1)
82template <
class S1Ty,
class S2Ty>
84 if (
S1.size() < S2.size())
92template <
class S1Ty,
class S2Ty>
95 for (
const auto &
E :
S1)
110 using ElemTy =
decltype(*
S1.begin());
111 if constexpr (detail::HasMemberContains<S2Ty, ElemTy>) {
112 auto Pred = [&S2](
const auto &
E) {
return S2.contains(
E); };
114 if (
S1.size() < S2.size()) {
118 }
else if constexpr (detail::HasMemberEraseIter<S1Ty>) {
119 if (
S1.size() < S2.size()) {
120 typename S1Ty::iterator Next;
121 for (
typename S1Ty::iterator SI =
S1.begin(), SE =
S1.end(); SI != SE;
123 Next = std::next(SI);
124 if (S2.contains(*SI))
132 for (
const auto &
E : S2)
139template <
class S1Ty,
class S2Ty>
141 for (
const auto &
E : S2)
150template <
class S1Ty,
class S2Ty>
152 if (
S1.size() > S2.size())
154 for (
const auto It :
S1)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
decltype(std::declval< Set >().remove_if(std::declval< Fn >())) check_has_member_remove_if_t
decltype(std::declval< Set >().erase(std::declval< Set >().begin())) check_has_member_erase_iter_t
static constexpr bool HasMemberRemoveIf
static constexpr bool HasMemberEraseIter
This is an optimization pass for GlobalISel generic memory operations.
void set_intersect(S1Ty &S1, const S2Ty &S2)
set_intersect(A, B) - Compute A := A ^ B Identical to set_intersection, except that it works on set<>...
bool set_is_subset(const S1Ty &S1, const S2Ty &S2)
set_is_subset(A, B) - Return true iff A in B
void set_subtract(S1Ty &S1, const S2Ty &S2)
set_subtract(A, B) - Compute A := A - B
typename detail::detector< void, Op, Args... >::value_t is_detected
Detects if a given trait holds for some set of arguments 'Args'.
bool set_union(S1Ty &S1, const S2Ty &S2)
set_union(A, B) - Compute A := A u B, return whether A changed.
S1Ty set_intersection(const S1Ty &S1, const S2Ty &S2)
set_intersection(A, B) - Return A ^ B
S1Ty set_difference(const S1Ty &S1, const S2Ty &S2)
set_difference(A, B) - Return A - B
S1Ty set_intersection_impl(const S1Ty &S1, const S2Ty &S2)