[cfe-dev] LibTooling CompilationDatabase

Manuel Klimek klimek at google.com
Sun Mar 3 10:08:33 PST 2013


On Sun, Mar 3, 2013 at 6:30 PM, Lukas Vogel <lukedirtwalkerdev at gmail.com>wrote:

> Hi,
>
> I want to create a Tool integrated in another application therefore I
> won't have a main function to call the tool. Which means I want to create
> the compilation database myself.
> (I need the tool to translate from clang ast to another ast (in memory
> structure) for a visual representation of the code)
>
> Do I need a CompilationDatabase anyway because I only want to do
> frontendactions (no compilation - just preprocessing and ast visiting) ?
>

Yes.

>From the documentation I got the structure that is needed for compilation
> database file but I don't really understand what has to be in there.
>

If you have your own way to determine the various flags needed, you don't
need to go through a file - you can just implement your own
CompilationDatabase that returns the right flags for the right files.


> Also I would like to know what actually happens internally by calling
> CompilationDatabase::loadFromDirectory(..)
>
> Or would it be easier to just read the code in manually and then call
> runToolOnCode() ?
>
> I would be happy if someone could clarify this whole thing a bit or point
> me to a Tutorial or some other example. (I looked through the clang
> Documentation pages but it didn't help me so far)
>

Look at the source of CommonOptionsParser to see how to build up a
compilation database yourself / how you can inject your own compilation
database.

Cheers,
/Manuel


>
> Thanks in advance.
>
> Cheers,
>
> Lukas
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130303/65718f45/attachment.html>


More information about the cfe-dev mailing list