[LLVMdev] Vim auto completion

70 views
Skip to first unread message

Tobias Grosser

unread,
Oct 21, 2010, 5:11:50 PM10/21/10
to LLVM Developers Mailing List, Dan Gohman
Hi,

I have been watching the vim/clang autocompletion in utils/vim/vimrc for
a while. What is the status of this work? The last information I got is,
that there where still some patches missing, but this was before the
clang-2.8.
Any updates? Is it supposed to work with clang-2.8?

Thanks

Tobi
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Dan Gohman

unread,
Oct 21, 2010, 6:29:40 PM10/21/10
to Tobias Grosser, LLVM Developers Mailing List

On Oct 21, 2010, at 2:11 PM, Tobias Grosser wrote:

> Hi,
>
> I have been watching the vim/clang autocompletion in utils/vim/vimrc for a while. What is the status of this work? The last information I got is, that there where still some patches missing, but this was before the clang-2.8.
> Any updates? Is it supposed to work with clang-2.8?


It requires a clang patch, which I hadn't submitted yet. I've sent out the
requisite clang patch to cfe-commits now (support auto-completion on stdin).

There's room for improvement in the vimrc file, in particular in the way
overloaded functions are handled, but it's pretty usable already.

Dan

Tobias Grosser

unread,
Oct 21, 2010, 8:01:06 PM10/21/10
to Dan Gohman, LLVM Developers Mailing List
On 10/21/2010 06:29 PM, Dan Gohman wrote:
>
> On Oct 21, 2010, at 2:11 PM, Tobias Grosser wrote:
>
>> Hi,
>>
>> I have been watching the vim/clang autocompletion in utils/vim/vimrc for a while. What is the status of this work? The last information I got is, that there where still some patches missing, but this was before the clang-2.8.
>> Any updates? Is it supposed to work with clang-2.8?
>
>
> It requires a clang patch, which I hadn't submitted yet. I've sent out the
> requisite clang patch to cfe-commits now (support auto-completion on stdin).
>
> There's room for improvement in the vimrc file, in particular in the way
> overloaded functions are handled, but it's pretty usable already.

It works great and is reasonable fast.

Thanks a lot

Tobi

Dan Gohman

unread,
Oct 30, 2010, 12:27:30 PM10/30/10
to LLVM Developers Mailing List, Tobias Grosser
The clang patches are now applied, so vim auto completion now works mostly
out-of-the-box -- just build clang, set up your PATH for clang and clang++,
and copy utils/vim/vimrc to ~/.vimrc (or symlink, or do your own thing).

To configure the clang command-line, look for the g: configuration
variables in the vimrc file.

I'm open to suggestions about the handling of function parameters. One
option would be to emit something like

foo(/*int x*/, /*int y*/)

to show the types of the arguments to be filled in. Right now this information
is just in the info box at the top.

Dan

moesasji

unread,
Mar 1, 2011, 5:47:07 PM3/1/11
to llv...@cs.uiuc.edu
Dan Gohman <gohman <at> apple.com> writes:

>
> The clang patches are now applied, so vim auto completion now works mostly
> out-of-the-box -- just build clang, set up your PATH for clang and clang++,
> and copy utils/vim/vimrc to ~/.vimrc (or symlink, or do your own thing).
>
> To configure the clang command-line, look for the g: configuration
> variables in the vimrc file.
>

I've been trying to get VIM to compile c++ code using clang++ based on the above
comments as I prefer its debug output over gcc. Unfortunately so far without
much success and Google does not really help me in finding a solution. So I hope
that someone can point me in the correct direction as I would like to see how
the vim autocompletion works.

I'm currently using the 2.9 branch of clang + llvm on FreeBSD stable and can
compile a hello world program from the commandline directly so both clang and
clang++ are in the path. However when running vim with the above vimrc file I
however fail to compile the same bit of code from within VIM (using :make
<program name>).

In this I set make in VIM to cLang by typing :set makeprg=clang in VIM. Yet the
output I get makes no sense to me although it clearly is using clang to do the
compile. Hopefully somebody can point out what I do wrong here?

fyi) below is the compiler or linker output I get when running :make hello
although it probably is not relevant. The same code compiles without problems
when compiling from the CMD-line
---
hello:(.data+0x8): multiple definition of `__dso_handle'
/usr/lib/crtbegin.o:(.data+0x0): first defined here
hello: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/crti.o:/usr/src/lib/csu/amd64/crti.S:(.init+0x0): first defined here
hello:(.data+0x0): multiple definition of `__progname'
/usr/lib/crt1.o:(.data+0x0): first defined here
hello: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/crt1.o:crt1.c:(.text+0x0): first defined here
hello: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/crti.o:/usr/src/lib/csu/amd64/crti.S:(.fini+0x0): first defined here
/usr/local/bin/ld: error in hello(.eh_frame); no .eh_frame_hdr table will be
created.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
---

Reply all
Reply to author
Forward
0 new messages