Move loop variable update.
Thanks to Dmitri Gribenko for the suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171889 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index cc692cd..1704de6 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -10501,11 +10501,10 @@
// and, because of the two phase lookup, this function is called with at
// decl in the middle of a decl chain. We loop to maintain the invariant
// that once a decl is used, all decls after it are also used.
- for (FunctionDecl *F = Func->getMostRecentDecl();;) {
+ for (FunctionDecl *F = Func->getMostRecentDecl();; F = F->getPreviousDecl()) {
F->setUsed(true);
if (F == Func)
break;
- F = F->getPreviousDecl();
}
}