From: Dmitri Gribenko Date: Tue, 18 Jun 2013 04:02:26 +0000 (+0000) Subject: ArrayRef'ize CodeCompletionContext::getNumSelIdents() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=68effa0d764cf6fc7b6f9729481ee2c6c5143f3b;p=clang ArrayRef'ize CodeCompletionContext::getNumSelIdents() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184168 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h index b152cca9ab..64de82c6b0 100644 --- a/include/clang/Sema/CodeCompleteConsumer.h +++ b/include/clang/Sema/CodeCompleteConsumer.h @@ -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 getSelIdents() const { return SelIdents; } /// \brief Determines whether we want C++ constructors as results within this /// context. diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index bfd54f5c00..411728b789 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -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++) { + IdentifierInfo *selIdent = Context.getSelIdents()[i]; + if (selIdent != NULL) { + StringRef selectorString = Context.getSelIdents()[i]->getName(); + AllocatedResults.Selector += selectorString; } + AllocatedResults.Selector += ":"; } QualType baseType = Context.getBaseType();