]> granicus.if.org Git - clang/commitdiff
Rewrite reverse iteration loop in a more natural countdown manner.
authorTed Kremenek <kremenek@apple.com>
Sat, 13 Nov 2010 05:55:56 +0000 (05:55 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 13 Nov 2010 05:55:56 +0000 (05:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118990 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index 062a36729121f344a6b283be8b3770c787c69ec5..72726e385a2fed9a45c44e83e8a46e8f9d280ce7 100644 (file)
@@ -1805,10 +1805,8 @@ void EnqueueVisitor::VisitCXXNewExpr(CXXNewExpr *E) {
     AddStmt(E->getPlacementArg(I-1));
 }
 void EnqueueVisitor::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *CE) {
-  // Note that we enqueue things in reverse order so that
-  // they are visited correctly by the DFS.
-  for (unsigned I = 1, N = CE->getNumArgs(); I != N; ++I)
-    AddStmt(CE->getArg(N-I));
+  for (unsigned I = CE->getNumArgs(); I > 1 /* Yes, this is 1 */; --I)
+    AddStmt(CE->getArg(I-1));
   AddStmt(CE->getCallee());
   AddStmt(CE->getArg(0));
 }