On Mon, Jun 17, 2013 at 9:44 PM, Dmitri Gribenko <[email protected]> wrote: > On Mon, Jun 17, 2013 at 9:27 PM, David Blaikie <[email protected]> wrote: >> On Mon, Jun 17, 2013 at 9:02 PM, Dmitri Gribenko <[email protected]> wrote: >>> Author: gribozavr >>> Date: Mon Jun 17 23:02:26 2013 >>> New Revision: 184168 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=184168&view=rev >>> Log: >>> ArrayRef'ize CodeCompletionContext::getNumSelIdents() >>> >>> Modified: >>> cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h >>> cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp >>> >>> Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=184168&r1=184167&r2=184168&view=diff >>> ============================================================================== >>> --- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original) >>> +++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Mon Jun 17 23:02:26 >>> 2013 >>> @@ -303,10 +303,7 @@ public: >>> QualType getBaseType() const { return BaseType; } >>> >>> /// \brief Retrieve the Objective-C selector identifiers. >>> - IdentifierInfo * const *getSelIdents() const { return SelIdents.data(); } >>> - >>> - /// \brief Retrieve the number of Objective-C selector identifiers. >>> - unsigned getNumSelIdents() const { return SelIdents.size(); } >>> + ArrayRef<IdentifierInfo *> getSelIdents() const { return SelIdents; } >>> >>> /// \brief Determines whether we want C++ constructors as results within >>> this >>> /// context. >>> >>> Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=184168&r1=184167&r2=184168&view=diff >>> ============================================================================== >>> --- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original) >>> +++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Mon Jun 17 23:02:26 >>> 2013 >>> @@ -562,15 +562,13 @@ namespace { >>> AllocatedResults.Contexts = getContextsForContextKind(contextKind, >>> S); >>> >>> AllocatedResults.Selector = ""; >>> - if (Context.getNumSelIdents() > 0) { >>> - for (unsigned i = 0; i < Context.getNumSelIdents(); i++) { >>> - IdentifierInfo *selIdent = Context.getSelIdents()[i]; >>> - if (selIdent != NULL) { >>> - StringRef selectorString = >>> Context.getSelIdents()[i]->getName(); >>> - AllocatedResults.Selector += selectorString; >>> - } >>> - AllocatedResults.Selector += ":"; >>> + for (unsigned i = 0, e = Context.getSelIdents().size(); i != e; i++) >>> { >> >> Might be nicer to use iterators here? rather than having to write >> out/call Context.getSelIdents() a couple of times on each iteration. > > Of course this makes sense. I was just doing a mechanical transformation. > Changed in r184169.
Looks great (I'm on the fence about bothering to name that variable versus just checking the deref, then derefing again - your choice is fine by me) Thanks! _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
