[cfe-dev] CompilerInstance and C++

Manuel Klimek klimek at google.com
Fri Mar 1 01:46:16 PST 2013


On Fri, Mar 1, 2013 at 10:42 AM, Lukas Vogel <lukedirtwalkerdev at gmail.com>wrote:

> Okay I will look into this thank you.
>
> Can you please tell me if I will be able to have control over all
> Preprocessor directives and over the full C++ AST using either Libclang or
> Libtooling?
>

See http://clang.llvm.org/docs/Tooling.html

With libclang you have less constrol than with libtooling, but libclang is
a higher abstraction and more stable interface.


> The aim of my project is to import C++ code (including included files)
> into a Visual Environment.
> Meaning i need to know in which file something was declared/defined is
> there a way to see this in just the AST?
>

Yes. I think both libclang and libtooling should be fine for this (although
I don't have a lot of experience with libclang).

I just have the fear that LibClang and LibTooling will not be enough for
> the whole task..?
>
> I appreciate any comment/help on this.
>
> Cheers,
> Lukas
>
>
>
>
>
>
> 2013/3/1 Manuel Klimek <klimek at google.com>
>
>> Using CompilerInstance is non-trivial. To make your life easier, there's
>> LibTooling:
>> http://clang.llvm.org/docs/LibTooling.html
>>
>> If you want a more stable interface I'd suggest you also take a look at
>> LibClang.
>>
>> Cheers,
>> /Manuel
>>
>>
>>  On Thu, Feb 28, 2013 at 11:18 PM, Lukas Vogel <
>> lukedirtwalkerdev at gmail.com> wrote:
>>
>>>  Hi,
>>>
>>> I try to parse c++ code, for now just very simple code like this:
>>>
>>> class Testing {
>>>
>>> public:
>>>
>>>     Testing(){}
>>>
>>> };
>>>
>>>
>>>
>>>
>>> My Code is based on a CompilerInstance but I always get the following
>>>
>>> error: unknown type name 'class'
>>>
>>>
>>>
>>>
>>> I tried to somehow set the LangOptions but still didn't get it to work...
>>>
>>>
>>>
>>> My code is here https://github.com/lukedirtwalker/Envision/blob/cppimport/CppImport/src/cppimportmanager.cpp
>>>
>>>
>>>
>>> Thanks for any help :)
>>>
>>>
>>> _______________________________________________
>>> 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/20130301/17e4af92/attachment.html>


More information about the cfe-dev mailing list