[LLVMdev] clang code-completion question

Nick Lewycky nicholas at mxc.ca
Tue Nov 27 22:51:22 PST 2012


[bcc llvm-dev, +cfe-dev]

Dmitry Frank wrote:
> Dear developers,
>
> First of all, thank you for your job on clang, now I use clang as
> autocompletion tool with my Vim, and it seems to work awesome. But I
> have some questions:
>
>   1) Is it possible to make clang to complete pointers to functions as a
> functions? I mean, I want to get function prototype, with returning
> value type and all the parameters.

Clang certainly knows all the relevant information, but it's not clear 
how this would work in code completion. What do you expect to have in 
the buffer, and where would the cursor be for clang to complete?

You'll need to have already typed something that makes it clear that the 
next thing clang ought to do is complete the type of function prototype. 
Usually completion looks forwards, and wouldn't you have already needed 
to type the return type to get to the function name? Maybe I'm just 
failing to visualize what we're doing here.

> 2) Is it possible to make completion work inside structure initializers?
> I mean, like that:
>
> typedef  struct  {
>     int  a;
>     int  b;
> } T_MyStruct;
>
> int  main(void)
> {
>     T_MyStruct my_struct = {
>        .a =0,
>        ./*cursor is here. I want to get list of struct members: [a, b]*/
>     };
> }

This sounds like a great missing-feature bug report. Please file it at 
llvm.org/bugs !

Nick



More information about the llvm-dev mailing list