[cfe-dev] AST node creation

Ted Kremenek kremenek at apple.com
Mon Mar 22 20:28:47 PDT 2010


Hi Kalyan,

If you want to see where various AST nodes are created, you can try putting breakpoints in many of the 'Create()' static member functions that occur in many of the subclasses of Stmt, or search for the 'new (ASTContext)' form that is used to create ASTs using the allocator associated with the ASTContext object.  For example:

$ grep -r "[)] ForStmt" *
lib/Frontend/PCHReaderStmt.cpp:      S = new (Context) ForStmt(Empty);
lib/Sema/SemaStmt.cpp:  return Owned(new (Context) ForStmt(First, Second, ConditionVar, Third, Body, 

libSema is the semantic analyzer, so that's where a ForStmt will get created during regular compilation.  The AST is defined in libAST, with the important header files being Stmt.h, Decl.h, and their derivatives.

Cheers,
Ted

On Mar 22, 2010, at 7:46 PM, kalyan ponnala wrote:

> Hi,
> 
> I am trying to understand about ASTs in clang by stepping through the code. I am using a program with "for loop". 
> Can someone tell me better places to put breakpoints which would help me understand that particular part of clang. 
> 
> Thanks.
> 
> -- 
> Kalyan Ponnala
> phone: 8163772059
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100322/2e50edb1/attachment.html>


More information about the cfe-dev mailing list