[LLVMdev] LLVM and Eclipse

Tilmann Scheller tilmann.scheller at googlemail.com
Thu Jul 2 01:34:41 PDT 2009


Hi Patrick,

On Thu, Jul 2, 2009 at 12:17 AM, Patrick Alexander
Simmons<simmon12 at cs.uiuc.edu> wrote:
> Has anyone tried using the Eclipse CDT plugin (or another C++ IDE) to
> develop code in LLVM?  I'm specifically interested in getting code
> completion to work.
I've been sucessfully using the Eclipse CDT with LLVM for quite a
while now. The official releases of Eclipse CDT 5.0 can not parse LLVM
successfully, so please make sure to use Eclipse CDT 6.0.

Setting up an Eclipse CDT project for LLVM is rather easy, basically
the only thing you need to do is to tell Eclipse where to find the
header files of LLVM (however setting up the project can take some
time, as there are quite a few paths to add). Apparently Eclipse CDT
6.0 has improved header auto-detection which in principle should not
require you to set up header paths manually, I'm not sure how well it
works though and never tried it because I reused my project file from
Eclipse CDT 5.0.

To find out which paths are missing, right click your project in the
Project Explorer and select Index -> Search for Unresolved Includes,
this will give you a list of header files which aren't found by
Eclipse yet. Note that some included files are auto-generated during
the build process, e.g. config.h or C++ code generated by TableGen, so
you need to make sure to set up the necessary paths to your OBJDIR.
It's a bit of work to set up all those paths but it's really worth it
and it dramatically improves the accuracy of the code
completion/cross-referencing/call graph/..., and it only needs to be
done once of course.

It might be worth to put an Eclipse CDT project file with relative
paths to the header files in the LLVM SVN repository to make it easier
for people to use Eclipse in the future (my project files currently
contain absolute paths, so they're probably not useful to other
people).

Greetings,

Tilmann



More information about the llvm-dev mailing list