<div dir="ltr">Hi,<div><br></div><div style>Problem: Want to parse C++ classes in a header file and generate</div><div style>              serialize and deserialize methods for this class.</div><div style>              example:</div>
<div style>              sample.h</div><div style>               #include ....</div><div style>                class Test</div><div style>                {</div><div style>                    std::map<int,string> myMap;</div>
<div style>                    int i;</div><div style>                    string s;</div><div style>                    A obj;</div><div style>                };</div><div style><br></div><div style>==>Transform it as below</div>
<div style><div>                class Test</div><div>                {</div><div>                    std::map<int,string> myMap;</div><div>                    int i;</div><div>                    string s;</div><div>
                    A obj;</div><div style>                   public:</div><div style>                    void* encode();</div><div>                };</div><div><br></div><div style>            void*     Test::encode()</div>
<div style>            {</div><div style>                for( i- 0; i<myMap.size(); i++)</div><div style>                encodeString();</div><div style><br></div><div style>                 encodeInt();</div><div style>
<br></div><div style>                 encodeString();</div><div style>                 obj.encode();</div><div style><br></div><div style>               return buf;</div><div style>            }</div><div style>            </div>
<div>With the tutotials around i could setup the compiler instance<br></div></div><div style>and ASTConsumer and ASTVisitor/</div><div style>In the ASTRecursive visitor... i could overload visitRecordDecl(...);</div><div style>
On getting a CXXRecordDecl...i have iterated through FieldDecl</div><div style>Now From FieldDecl...i want to extract information like</div><div style>it is map made from int and string...</div><div style>Am not able get the relationship of FieldDecl to CTemplateDecl...</div>
<div style>and from CTemplateDecl how to extract the params?</div><div style><br></div><div style>Pls provide direction how to proceed further...</div><div style><br></div><div style>regards</div><div style>ragha</div></div>