RetainCountChecker: Replace some loops with std:: algorithms.
llvm-svn: 188581
This commit is contained in:
parent
91c9867049
commit
ab3838ab98
|
@ -321,11 +321,7 @@ public:
|
|||
/// Return the number of argument effects. This is O(n) in the number
|
||||
/// of arguments.
|
||||
unsigned getNumArgs() const {
|
||||
unsigned N = 0;
|
||||
for (ArgEffects::iterator I = Args.begin(), E = Args.end(); I != E; ++I) {
|
||||
++N;
|
||||
};
|
||||
return N;
|
||||
return std::distance(Args.begin(), Args.end());
|
||||
}
|
||||
|
||||
void addArg(ArgEffects::Factory &af, unsigned idx, ArgEffect e) {
|
||||
|
@ -1754,16 +1750,6 @@ void CFRefReport::addGCModeDescription(const LangOptions &LOpts,
|
|||
addExtraText(GCModeDescription);
|
||||
}
|
||||
|
||||
// FIXME: This should be a method on SmallVector.
|
||||
static inline bool contains(const SmallVectorImpl<ArgEffect>& V,
|
||||
ArgEffect X) {
|
||||
for (SmallVectorImpl<ArgEffect>::const_iterator I=V.begin(), E=V.end();
|
||||
I!=E; ++I)
|
||||
if (*I == X) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isNumericLiteralExpression(const Expr *E) {
|
||||
// FIXME: This set of cases was copied from SemaExprObjC.
|
||||
return isa<IntegerLiteral>(E) ||
|
||||
|
@ -1925,7 +1911,8 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N,
|
|||
RefVal PrevV = *PrevT;
|
||||
|
||||
// Specially handle -dealloc.
|
||||
if (!GCEnabled && contains(AEffects, Dealloc)) {
|
||||
if (!GCEnabled && std::find(AEffects.begin(), AEffects.end(), Dealloc) !=
|
||||
AEffects.end()) {
|
||||
// Determine if the object's reference count was pushed to zero.
|
||||
assert(!(PrevV == CurrV) && "The typestate *must* have changed.");
|
||||
// We may not have transitioned to 'release' if we hit an error.
|
||||
|
@ -1938,7 +1925,8 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N,
|
|||
}
|
||||
|
||||
// Specially handle CFMakeCollectable and friends.
|
||||
if (contains(AEffects, MakeCollectable)) {
|
||||
if (std::find(AEffects.begin(), AEffects.end(), MakeCollectable) !=
|
||||
AEffects.end()) {
|
||||
// Get the name of the function.
|
||||
const Stmt *S = N->getLocation().castAs<StmtPoint>().getStmt();
|
||||
SVal X =
|
||||
|
|
Loading…
Reference in New Issue