[cfe-dev] Accessing c++11 in class initializer AST nodes from lib clang
mobi phil
mobi at mobiphil.com
Wed Feb 25 08:20:13 PST 2015
cmatch is C interface with callbacks, not finished though. It wants to
be an extension to c api. Have a look, feedback is wellcome
On Wed, Feb 25, 2015 at 5:18 PM, derek <derek at hipgraphics.com> wrote:
> I am using libclang (the C api to clang).
> -Derek
>
>
> On 2015-02-25 11:02, mobi phil wrote:
>>
>> There is a libclang that is a C interface to the full clang and the
>> full clang lib. Which one are you intending to use?
>>
>> Without giving you a precise answer, kind of advice from my experince:
>> print the ast with -dump-ast, see the type of node, and try to
>> identify functions that brings you from FieldDecl to the initialiazer.
>>
>> I tried to identify such methods in my tool, it may help you:
>> https://github.com/mobiphil/cmatch
>>
>>
>>
>> On Wed, Feb 25, 2015 at 4:00 PM, derek <derek at hipgraphics.com> wrote:
>>>
>>> I am working on some code generation tools that use lib clang.
>>> All my code is now c++11 based.
>>> I was hoping to be able to access the class initializer nodes for member
>>> variables such as here:
>>>
>>> class Foo
>>> {
>>> float x = 3.1415; // want to access the 3.1415 attached to the
>>> FieldDecl
>>> node for x
>>> };
>>>
>>> I can’t seem to find anything in libclang that will allow that.
>>>
>>> I believe the C++ method in clang that I want access to is
>>>
>>> Expr* clang::FieldDecl::getInClassInitializer() const
>>>
>>> but do not see a way of getting that in libclang. Any way I can do this
>>> or
>>> is this just a limitation I cannot get around.
>>> Thanks, -Derek
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
--
rgrds,
mobi phil
being mobile, but including technology
http://mobiphil.com
More information about the cfe-dev
mailing list