r184169 - Simplify a loop in ProcessCodeCompleteResults(). Pointed out by David Blaikie

Dmitri Gribenko gribozavr at gmail.com
Mon Jun 17 21:41:50 PDT 2013


Author: gribozavr
Date: Mon Jun 17 23:41:50 2013
New Revision: 184169

URL: http://llvm.org/viewvc/llvm-project?rev=184169&view=rev
Log:
Simplify a loop in ProcessCodeCompleteResults().  Pointed out by David Blaikie

Modified:
    cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp

Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=184169&r1=184168&r2=184169&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Mon Jun 17 23:41:50 2013
@@ -562,12 +562,12 @@ namespace {
       AllocatedResults.Contexts = getContextsForContextKind(contextKind, S);
       
       AllocatedResults.Selector = "";
-      for (unsigned i = 0, e = Context.getSelIdents().size(); i != e; i++) {
-        IdentifierInfo *selIdent = Context.getSelIdents()[i];
-        if (selIdent != NULL) {
-          StringRef selectorString = Context.getSelIdents()[i]->getName();
-          AllocatedResults.Selector += selectorString;
-        }
+      ArrayRef<IdentifierInfo *> SelIdents = Context.getSelIdents();
+      for (ArrayRef<IdentifierInfo *>::iterator I = SelIdents.begin(),
+                                                E = SelIdents.end();
+           I != E; ++I) {
+        if (IdentifierInfo *selIdent = *I)
+          AllocatedResults.Selector += selIdent->getName();
         AllocatedResults.Selector += ":";
       }
       





More information about the cfe-commits mailing list