[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] [LLVMdev] clang code-completion question
From:       Douglas Gregor <dgregor () apple ! com>
Date:       2012-11-28 15:16:48
Message-ID: EEA8887F-AB75-404D-9978-99AC542E30A1 () apple ! com
[Download RAW message or body]


On Nov 27, 2012, at 10:51 PM, Nick Lewycky <nicholas@mxc.ca> wrote:

> [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?

Presumably, this comes from providing a code completion in an expression context, \
e.g.,

void foo(int (*fp)(int, int)) {
  /* complete here */
}

currently produces a result for 'fp', but one one for 'fp(<#int#>, <#int#>)'.

Generally, I think this would be an improvement, for pointers to functions, \
references to functions, blocks, and lambdas. Perhaps member pointers as well. \
However, it might be slightly annoying when you're actually trying to pass the \
function pointer somewhere else:

void bar(int (*fp)(int, int)) { }

void foo(int (*fp)(int, int)) {
  bar(/*complete here*/
}

Contextual type information can help when we have it, but we often don't have it.

This is work filing a bug on.




> 
> > 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 !


Yes, this is definitely a missing feature.

	- Doug
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic