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.
--Patrick
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.
--Patrick
Hello Patrick,
Eclipse works if you have LLVM installed from source before you install Eclipse since LLVM's headers will be in the default location for headers to be. You may also have to start a new project before the headers latch in to memory. I tried making a new project using the requesters on the first run and that didn't do it. Note: You'll have to go into the properties menu of the C++ file and under C/C++ build under options under miscellaneous you'll have to add `/usr/local/bin/llvm-config --cxxflags --libs all` and note the back-quotes rather than regular quotes. If the headers don't show up in the root directory of the project, code completion won't work either.
Hi Patrick,
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
Tilmann Scheller <tilmann.scheller@googlemail.com> writes:
[snip]
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).
CMake can generate Eclipse projects. Have you tried it?
Hi Oscar,
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).CMake can generate Eclipse projects. Have you tried it?
I just did, works great - all include paths are set up properly (!).
Apparently CMake deletes the C++ files which are generated by
TableGen, is it possible to tell CMake to not throw them away?
I'm impressed how easy this is, you only need to do a "cmake -G
'Eclipse CDT4 - Unix Makefiles' $SRCDIR" in your $OBJDIR and import
the project created in $OBJDIR into Eclipse.
Thanks for adding CMake support to LLVM!
Greetings,
Tilmann
Tilmann Scheller <tilmann.scheller@googlemail.com> writes:
Apparently CMake deletes the C++ files which are generated by
TableGen, is it possible to tell CMake to not throw them away?
Certainly the build does not delete those files. Maybe you looked at the
wrong place. Try $OBJDIR/lib/Target/X86, for instance. There you will
see the *.inc files that TableGen creates.
Thanks for adding CMake support to LLVM!
You're welcome.
Hi Oscar,