I am wondering if for a given c++ class record (CXXRecordDecl) is possible to walk through the global variables (members).
class Consumer : public Process
Consumer(const Id& n, In<int>& i);
const char* type() const;
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.
Thanks for the reply, RecordDecl is exactly what I wanted to use. However as I am using a type derived from a template I am getting the following output:
Is there any way to get the name of type (OutPort) and the parameter of the template (int), independently?
I did something similar where I wanted to get the class/type names of a variable declared using templates. I had class data members that looked like:
sc_in< sc_int<32> > value;
I used RecursiveASTVisitor to visit the Type class. This code may provide some guidance: https://github.com/hdpatel/systemc-clang/blob/revamp/src/FindTemplateTypes.h
Hope it helps.