From: Dmitri Gribenko Date: Tue, 18 Jun 2013 04:41:50 +0000 (+0000) Subject: Simplify a loop in ProcessCodeCompleteResults(). Pointed out by David Blaikie X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5c1a9f3bc0f11905974450ee7729ae3d556d316f;p=clang Simplify a loop in ProcessCodeCompleteResults(). Pointed out by David Blaikie git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184169 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index 411728b789..58dc021870 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -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 SelIdents = Context.getSelIdents(); + for (ArrayRef::iterator I = SelIdents.begin(), + E = SelIdents.end(); + I != E; ++I) { + if (IdentifierInfo *selIdent = *I) + AllocatedResults.Selector += selIdent->getName(); AllocatedResults.Selector += ":"; }