[cfe-dev] ConsumeToken()
Sebastian Redl
sebastian.redl at getdesigned.at
Fri Sep 24 14:16:31 PDT 2010
On Sep 24, 2010, at 1:41 PM, Wei Li wrote:
> Dear all:
>
> When you use ConsumeToken(), does it mean that token is part of AST
> after consuming it?
No, only Sema adds to the AST. ConsumeToken(), called by the parser, just reads the next token and updates a bit of bookkeeping data. In other words, if you haven't processed the token by the time you call ConsumeToken, it is lost.
ConsumeToken returns the source location of the token it just consumed.
> How can I print parse tree/ AST using clang?
Clang doesn't produce a parse tree. For printing the AST, the various AST nodes have dump() and print() functions.
Sebastian
More information about the cfe-dev
mailing list