From f26d5391abb00ff8afe8805d90a2b8052b319bc9 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 8 Jan 2013 19:58:34 +0000 Subject: [PATCH] Move loop variable update. Thanks to Dmitri Gribenko for the suggestion. llvm-svn: 171889 --- clang/lib/Sema/SemaExpr.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index cc692cda6327..1704de6e95ee 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -10501,11 +10501,10 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func) { // 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(); } }