[cfe-dev] code completion macros show private stuff

Sergey Kalinichev via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 30 01:05:59 PDT 2015


Hi,

Seems like it's used when "clang -cc1 -code-completion-at=..." is
invoked. In that case, I think it makes more sense to print that a
result is inaccessible/unavailable instead. Also this is what
"c-index-test -code-completion-at" does.

--
Sergey

On 9/29/15, Willy WOLFF <willy.mh.wolff at gmail.com> wrote:
> Hi,
>
> This tool is used by utis/clang-completion-mode.el for allowing code
> completion in emacs, I don't know if it is used somewhere else.
>
> For code completion, it is clearly not useful to show something which
> could cause errors. And for debug purpose, it might make sense to show
> this information, no?
>
> On 29 September 2015 at 18:36, Milian Wolff <mail at milianw.de> wrote:
>> On Dienstag, 29. September 2015 09:36:57 CEST Manuel Klimek wrote:
>>> +sergey, milian
>>>
>>> On Mon, Sep 28, 2015 at 6:22 PM Willy WOLFF via cfe-dev <
>>>
>>> cfe-dev at lists.llvm.org> wrote:
>>> > Hi all,
>>> >
>>> > Regarding the code completion macros tool; by default, this tool, when
>>> > asked for completing a method or an attribute, it proposes all
>>> > possibilities, whatever it is declared public or private.
>>> >
>>> > Would it not be more interesting to show only correct completion by
>>> > default? Or at least, give this information.
>>>
>>> Generally seems to make sense; Sergey, Milian, thoughts?
>>
>> Hey all,
>>
>> it makes sense from reading the code. But what tool are we talking about?
>> This
>> is code inside PrintingCodeCompleteConsumer::ProcessCodeCompleteResults -
>> where is that being used? If this is used for debug purposes, it might
>> make
>> sense to print all results, no?
>>
>> Bye
>>
>>> > I've modified locally the tool to do so:
>>> > $ svn diff
>>> > Index: CodeCompleteConsumer.cpp
>>> > ===================================================================
>>> > --- CodeCompleteConsumer.cpp (revision 248706)
>>> > +++ CodeCompleteConsumer.cpp (working copy)
>>> > @@ -437,6 +437,10 @@
>>> >
>>> >    // Print the results.
>>> >    for (unsigned I = 0; I != NumResults; ++I) {
>>> >
>>> > +    if ((Results[I].Availability == CXAvailability_NotAvailable) ||
>>> > +        (Results[I].Availability == CXAvailability_NotAccessible))
>>> > +      continue;
>>> > +
>>> >
>>> >      OS << "COMPLETION: ";
>>> >      switch (Results[I].Kind) {
>>> >
>>> >      case CodeCompletionResult::RK_Declaration:
>>> > Best Regards,
>>> > Willy.
>>> > _______________________________________________
>>> > cfe-dev mailing list
>>> > cfe-dev at lists.llvm.org
>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>> --
>> Milian Wolff
>> mail at milianw.de
>> http://milianw.de
>



More information about the cfe-dev mailing list