<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Miguel,<div><br></div><div>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:</div><div><br></div><div>sc_in< sc_int<32> > value;</div><div><br></div><div>I used RecursiveASTVisitor to visit the Type class.  This code may provide some guidance: <a href="https://github.com/hdpatel/systemc-clang/blob/revamp/src/FindTemplateTypes.h">https://github.com/hdpatel/systemc-clang/blob/revamp/src/FindTemplateTypes.h</a></div><div><br></div><div>Hope it helps.</div><div>--</div><div>Hiren</div><div><br></div><div><br><div><div><div>On 2013-01-23, at 5:11 AM, Miguel Aguilar wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Jordan,<br><br>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:<br><br>OutPort<int><br><br>Is there any way to get the name of type (OutPort) and the parameter of the template (int), independently?<br><br>Thanks,<br><br>Miguel<br><br>On 01/22/2013 06:27 PM, Jordan Rose wrote:<br><blockquote type="cite">On Jan 22, 2013, at 4:21 , Miguel Aguilar<<a href="mailto:miguel.aguilar@ice.rwth-aachen.de">miguel.aguilar@ice.rwth-aachen.de</a>>  wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Hi,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I am wondering if for a given c++ class record (CXXRecordDecl) is possible to walk through the global variables (members).<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">For example:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">class Consumer : public Process<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">{<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">public:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">  Consumer(const Id&  n, In<int>&  i);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">  const char* type() const;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">  void main();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">private:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">  InPort<int>  in;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">};<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Here I would like to parse the member  "InPort<int>  in;" in order to get the type and the name of the variable.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I think you want RecordDecl's inherited field_begin and field_end.<br></blockquote><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br><br></div></blockquote></div><br></div></div></body></html>