forked from OSchip/llvm-project
Replacing some manual iterations with standard algorithms. No functional changes intended.
llvm-svn: 208783
This commit is contained in:
parent
f05ca45b1e
commit
42f9a8a7f9
|
@ -849,45 +849,38 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an iterator
|
|
||||||
iterator findLockIter(FactManager &FM, const SExpr &M) {
|
iterator findLockIter(FactManager &FM, const SExpr &M) {
|
||||||
for (iterator I = begin(), E = end(); I != E; ++I) {
|
return std::find_if(begin(), end(), [&FM, &M](FactID ID) {
|
||||||
const SExpr &Exp = FM[*I].MutID;
|
return FM[ID].MutID.matches(M);
|
||||||
if (Exp.matches(M))
|
});
|
||||||
return I;
|
|
||||||
}
|
|
||||||
return end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LockData* findLock(FactManager &FM, const SExpr &M) const {
|
LockData *findLock(FactManager &FM, const SExpr &M) const {
|
||||||
for (const_iterator I = begin(), E = end(); I != E; ++I) {
|
auto I = std::find_if(begin(), end(), [&FM, &M](FactID ID) {
|
||||||
const SExpr &Exp = FM[*I].MutID;
|
return FM[ID].MutID.matches(M);
|
||||||
if (Exp.matches(M))
|
});
|
||||||
return &FM[*I].LDat;
|
|
||||||
}
|
return I != end() ? &FM[*I].LDat : nullptr;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LockData* findLockUniv(FactManager &FM, const SExpr &M) const {
|
LockData *findLockUniv(FactManager &FM, const SExpr &M) const {
|
||||||
for (const_iterator I = begin(), E = end(); I != E; ++I) {
|
auto I = std::find_if(begin(), end(), [&FM, &M](FactID ID) -> bool {
|
||||||
const SExpr &Exp = FM[*I].MutID;
|
const SExpr &Expr = FM[ID].MutID;
|
||||||
if (Exp.matches(M) || Exp.isUniversal())
|
return Expr.isUniversal() || Expr.matches(M);
|
||||||
return &FM[*I].LDat;
|
});
|
||||||
}
|
|
||||||
return 0;
|
return I != end() ? &FM[*I].LDat : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FactEntry* findPartialMatch(FactManager &FM, const SExpr &M) const {
|
FactEntry *findPartialMatch(FactManager &FM, const SExpr &M) const {
|
||||||
for (const_iterator I=begin(), E=end(); I != E; ++I) {
|
auto I = std::find_if(begin(), end(), [&FM, &M](FactID ID) {
|
||||||
const SExpr& Exp = FM[*I].MutID;
|
return FM[ID].MutID.partiallyMatches(M);
|
||||||
if (Exp.partiallyMatches(M)) return &FM[*I];
|
});
|
||||||
}
|
|
||||||
return 0;
|
return I != end() ? &FM[*I] : nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// A Lockset maps each SExpr (defined above) to information about how it has
|
/// A Lockset maps each SExpr (defined above) to information about how it has
|
||||||
/// been locked.
|
/// been locked.
|
||||||
typedef llvm::ImmutableMap<SExpr, LockData> Lockset;
|
typedef llvm::ImmutableMap<SExpr, LockData> Lockset;
|
||||||
|
|
Loading…
Reference in New Issue