[cfe-dev] I want to find the Result of the AST Parsing

Alexander Kornienko alexfh at google.com
Thu Aug 16 07:25:45 PDT 2012


On Thu, Aug 16, 2012 at 4:14 PM, Journeyer J. Joh
<oosaprogrammer at gmail.com>wrote:

> Hello list,
>
> I am recently reading the source code of the Clang/LLVM with gdb.
> Among others I read about the AST Parsing these days. But finding the
> result of this parsing is difficult for me.
>
> I'd like to know where I can find the result of AST Parsing.
>
> I found where the AST Parsing is commited. It's shown below.
>
> break clang::ParseAST
> break clang::Parser::ParseTopLevelDecl
> break clang::Parser::ParseExternalDeclaration
> break clang::Parser::ParseDeclarationOrFunctionDefinition
> break clang::Parser::ParseDeclOrFunctionDefInternal
> break clang::Parser::ParseDeclarationSpecifiers
> break clang::Parser::ConsumeToken
> break clang::Parser::ParseDeclGroup
> break clang::Parser::ParseDeclarator
> break clang::Parser::ParseDeclaratorInternal
> break clang::Parser::ParseDirectDeclarator
> break clang::Parser::ParseFunctionDeclarator
> break clang::Sema::ActOnStartFunctionDeclarator
> break clang::Parser::ParseParameterDeclarationClause
> break clang::Parser::ParseDeclarationSpecifiers
> break clang::Parser::ParseDeclarator
> break clang::Parser::ParseFunctionDefinition
> break clang::Parser::ParseCompoundStatementBody
> break clang::Parser::ParseStatementOrDeclaration
> break clang::Parser::ParseDeclaration
> break clang::Parser::ParseExprStatement
>
> This is my break points used in gdb.
>
> I was able to trace the parsing of the C source code,
> BUT I couldn't find the result of this AST Parsing.
>
> I'd like to know where I can find the result of this AST Parsing.
> I'd like to find it using gdb.
>
> Or, I wonder if there is any way for me to print out the Parsed AST.
> Any utility or compiler options?
>
You can use

clang -cc1 -ast-dump filename.cpp *[header search and other options]** *

or

clang-check -ast-dump filename.cpp -- *[header search and other options]*

to dump the AST parsed from filename.cpp. You can also use
-ast-dump-filterfor both to filter dumped declarations by a certain
substring in name.


>
> Thank you very much in advance.
>
> Have a good day!
> --
> ----------------------------------------
> Journeyer J. Joh
> o o s a p r o g r a m m e r
> a t
> g m a i l  d o t  c o m
> ----------------------------------------
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



-- 
Best regards,
Alexander Kornienko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120816/3d1aaa29/attachment.html>


More information about the cfe-dev mailing list