[clang-tidy] Rewrite a for-range loop in the old style.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 4 Aug 2014 10:11:47 +0000 (10:11 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 4 Aug 2014 10:11:47 +0000 (10:11 +0000)
Haven't thought that I ever needed to do this, but in this case comparing the
index using pointer arithmetic turns out to be really ugly. It also generates
nasty sign-compare warnings on 32 bit targets.

llvm-svn: 214705

clang-tools-extra/clang-tidy/misc/ArgumentCommentCheck.cpp

index 5357b7c..4f7b535 100644 (file)
@@ -86,10 +86,10 @@ ArgumentCommentCheck::isLikelyTypo(llvm::ArrayRef<ParmVarDecl *> Params,
   if (ThisED >= UpperBound)
     return false;
 
-  for (const auto &Param : Params) {
-    if (&Param - Params.begin() == ArgIndex)
+  for (unsigned I = 0, E = Params.size(); I != E; ++I) {
+    if (I == ArgIndex)
       continue;
-    IdentifierInfo *II = Param->getIdentifier();
+    IdentifierInfo *II = Params[I]->getIdentifier();
     if (!II)
       continue;