[cfe-dev] Get the global variables (members) of a given C++ class

Jordan Rose jordan_rose at apple.com
Tue Jan 22 09:27:44 PST 2013


On Jan 22, 2013, at 4:21 , Miguel Aguilar <miguel.aguilar at ice.rwth-aachen.de> wrote:

> Hi,
> 
> I am wondering if for a given c++ class record (CXXRecordDecl) is possible to walk through the global variables (members).
> 
> 
> For example:
> 
> class Consumer : public Process
> {
> public:
>  Consumer(const Id& n, In<int>& i);
>  const char* type() const;
>  void main();
> 
> private:
>  InPort<int> in;
> };
> 
> 
> Here I would like to parse the member  "InPort<int> in;" in order to get the type and the name of the variable.


I think you want RecordDecl's inherited field_begin and field_end.



More information about the cfe-dev mailing list