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

Journeyer J. Joh oosaprogrammer at gmail.com
Thu Aug 16 07:55:09 PDT 2012


Thank you very much Alexander Kornienko! You replied to me so fast!

This would be very helpful for me!



But I'd like to also know where I need to look to find the result of
AST Parsing in the source code.

I tried to find it from 'ADecl' after 'P.ParseTopLevelDecl(ADecl)' in
the global function ParseAST(). But I couldn't find it there using
ddd.

Could somebody let me know where I need to look? (with gdb or ddd)

Thank you very much!

Journeyer J. Joh

2012/8/16 Alexander Kornienko <alexfh at google.com>:
>
>
> 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-filter
> for 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
>



-- 
----------------------------------------
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
----------------------------------------



More information about the cfe-dev mailing list