I've been studying ASTConsumer and RecursiveASTVisitor.  The easiest way to find objects, structs, class, enums, etc is clearly "HandleTagDeclDefinition" from ASTConsumer (see the function documentation). However, I still need to be able to gather global functions or functions local to a namespace. <div>
<br></div><div>I am looking at "HandleTopLevelDecl" within the ASTConsumer, but it seems to be geared for data declartion like "int x,y;". I am not 100 percent sure that it handles function definitions as well.</div>
<div><br></div><div>Second, ASTContext is a very general class, and it is a bear to parse through to find what I need. It seems that I could forgo the methods described above, and I could just use "HandleTranslationUnit" if I wanted to parse through the ASTContext. </div>
<div><br></div><div>RecursiveASTVisitor looks geared for template declarations and instantiations. It does not seem viable for the common function definitions, and it seems inept to handle class, struct, etc instantiations. </div>
<div><br></div><div>Any other advice or comments?</div><div><br></div><div>- Thanks</div><div>- Jeff Kunkel<br><br><div class="gmail_quote">On Sat, Nov 6, 2010 at 11:33 AM, David Chisnall <span dir="ltr"><<a href="mailto:csdavec@swan.ac.uk">csdavec@swan.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 5 Nov 2010, at 21:16, Jeff Kunkel wrote:<br>
<br>
> I need to gather or visit the classes, methods, and functions defined within a give clang compiler instance. Is there a simple interface to accomplish this?<br>
<br>
</div>This depends on what you wish to accomplish.  The simplest interface is via libclang, but it doesn't expose all of the details of the AST.  Alternatively, you can use the AST visitor or consumer interfaces.  The best approach depends on the level of detail that you need.<br>

<font color="#888888"><br>
David<br>
</font></blockquote></div><br></div>