[cfe-dev] Accessing c++11 in class initializer AST nodes from lib clang

derek derek at hipgraphics.com
Wed Feb 25 07:00:34 PST 2015


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




More information about the cfe-dev mailing list