mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Switch the SetVector::remove_if implementation to use partition which
preserves the values of the relocated entries, unlikely remove_if. This allows walking them and erasing them. Also flesh out the predicate we are using for this to support the various constraints actually imposed on a UnaryPredicate -- without this we can't compose it with std::not1. Thanks to Sean Silva for the review here and noticing the issue with std::remove_if. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165073 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2b87e06d26
commit
75eac5f0eb
@ -141,8 +141,9 @@ public:
|
|||||||
/// \returns true if any element is removed.
|
/// \returns true if any element is removed.
|
||||||
template <typename UnaryPredicate>
|
template <typename UnaryPredicate>
|
||||||
bool remove_if(UnaryPredicate P) {
|
bool remove_if(UnaryPredicate P) {
|
||||||
typename vector_type::iterator B = std::remove_if(vector_.begin(),
|
typename vector_type::iterator B = std::partition(vector_.begin(),
|
||||||
vector_.end(), P),
|
vector_.end(),
|
||||||
|
std::not1(P)),
|
||||||
E = vector_.end();
|
E = vector_.end();
|
||||||
if (B == E)
|
if (B == E)
|
||||||
return false;
|
return false;
|
||||||
|
@ -3273,8 +3273,10 @@ namespace {
|
|||||||
const SetType &Set;
|
const SetType &Set;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
typedef AllocaInst *argument_type;
|
||||||
|
|
||||||
IsAllocaInSet(const SetType &Set) : Set(Set) {}
|
IsAllocaInSet(const SetType &Set) : Set(Set) {}
|
||||||
bool operator()(AllocaInst *AI) { return Set.count(AI); }
|
bool operator()(AllocaInst *AI) const { return Set.count(AI); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user