Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Clang command line support for codecompletion
eranif:
I already integrated this code into codelite and it seems to work very well.
The problem is that it is too slow.
Most of the time the parsing is done using an in-complete source file so you will need to provide a string buffer containing the input string up to the point where the completion should appear.
The problem is that, I tried to use the completion using codelite's project itself on the file frame.cpp (one of the largest files in codelite project) it took 4 seconds for the completion to show (or even more, can't remember now it was 3-4 months ago)
It also lacks some crucial information (which I could not seem to get an access to, like an exact position of the match), I can probably obtain more information if I will link directly with the clang libraries - but for the POC (prove of concept) it seems too much for me.
I had several ideas of how to improve the responsiveness of the code-completion by using a pre-compiled header, but it seems like that PCH is not yet supported for C++ (at least it was not available couple of months ago)
You can search their mailing list and see the discussion I had with DGregor (he is the person that knows most about code-completion in clang)
About the binaries, I remembers that enabling optimization causes a crash or ICE using MinGW. Also, make sure you build clang in release mode (which is NOT the default) it will boost its performance a lot.
I will have a look at home of how I built clang and will see if I can upload the binaries to codelite's site
Eran
Jenna:
@ollydbg:
you can try this one: http://apt.jenslody.de/downloads/clang_win32.7z
Cross-build on linux, at least simple hello world works on my win-xp machine.
Pretty printing also seems to work.
You will most likely find a broken clang++.exe in the bin subfolder, this is just a symlink to clang.exe on linux, but neither 7z, nor windows can handle (linux-)symlinks.
To use clang++.exe, you can just copy clang.exe to clang++.exe .
ironhead:
--- Quote from: jens on October 26, 2010, 05:37:33 pm ---You will most likely find a broken clang++.exe in the bin subfolder, this is just a symlink to clang.exe on linux, but neither 7z, nor windows can handle (linux-)symlinks.
To use clang++.exe, you can just copy clang.exe to clang++.exe .
--- End quote ---
Not that it matters, but as a quick FYI, you can use tar to de-reference symlinks:
--- Code: ----h, --dereference follow symlinks; archive and dump the files they point to
--hard-dereference follow hard links; archive and dump the files they refer to
--- End code ---
I use these options when preparing MinGW packages that I've compiled under Cygwin.
Jenna:
--- Quote from: ironhead on October 26, 2010, 06:43:02 pm ---Not that it matters, but as a quick FYI, you can use tar to de-reference symlinks:
--- End quote ---
I know that, but I cros-compiled it on linux, and windows can not follow symlinks (at least not linux-symlinks, and the windows links are not real links, just link-files).
By the way, 7z seems to work correctly with symlinks (just access control and ownership is not copied without tar).
ollydbg:
--- Quote from: eranif on October 26, 2010, 03:38:46 pm ---I already integrated this code into codelite and it seems to work very well.
The problem is that it is too slow.
Most of the time the parsing is done using an in-complete source file so you will need to provide a string buffer containing the input string up to the point where the completion should appear.
The problem is that, I tried to use the completion using codelite's project itself on the file frame.cpp (one of the largest files in codelite project) it took 4 seconds for the completion to show (or even more, can't remember now it was 3-4 months ago)
It also lacks some crucial information (which I could not seem to get an access to, like an exact position of the match), I can probably obtain more information if I will link directly with the clang libraries - but for the POC (prove of concept) it seems too much for me.
I had several ideas of how to improve the responsiveness of the code-completion by using a pre-compiled header, but it seems like that PCH is not yet supported for C++ (at least it was not available couple of months ago)
You can search their mailing list and see the discussion I had with DGregor (he is the person that knows most about code-completion in clang)
About the binaries, I remembers that enabling optimization causes a crash or ICE using MinGW. Also, make sure you build clang in release mode (which is NOT the default) it will boost its performance a lot.
I will have a look at home of how I built clang and will see if I can upload the binaries to codelite's site
Eran
--- End quote ---
thanks eran for the explanation and help.
I just do a simple search and found that clang now support PCH, see: Precompiled Headers (PCH)
--- Quote ---Using Precompiled Headers with clang
The Clang compiler frontend, clang -cc1, supports two command line options for generating and using PCH files.
To generate PCH files using clang -cc1, use the option -emit-pch:
$ clang -cc1 test.h -emit-pch -o test.h.pch
This option is transparently used by clang when generating PCH files. The resulting PCH file contains the serialized form of the compiler's internal representation after it has completed parsing and semantic analysis. The PCH file can then be used as a prefix header with the -include-pch option:
$ clang -cc1 -include-pch test.h.pch test.c -o test.s
--- End quote ---
@jens:
thanks for your time and effort to build the win32 version of clang for me, it works quite well.
for the symlink issue, under windows, I use 7-zip to extract the files, but some files like clang++.exe was less than 10k. So, as you suggest, I need to copy and renamed the clang.exe.
I will do more test on clang today.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version