[clang-tools-extra] r214705 - [clang-tidy] Rewrite a for-range loop in the old style.

Benjamin Kramer benny.kra at googlemail.com
Mon Aug 4 03:11:47 PDT 2014


Author: d0k
Date: Mon Aug  4 05:11:47 2014
New Revision: 214705

URL: http://llvm.org/viewvc/llvm-project?rev=214705&view=rev
Log:
[clang-tidy] Rewrite a for-range loop in the old style.

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.

Modified:
    clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp?rev=214705&r1=214704&r2=214705&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp Mon Aug  4 05:11:47 2014
@@ -86,10 +86,10 @@ ArgumentCommentCheck::isLikelyTypo(llvm:
   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;
 





More information about the cfe-commits mailing list