[cfe-dev] My understanding of AST

Journeyer J. Joh oosaprogrammer at gmail.com
Sat Nov 3 17:30:38 PDT 2012


Hi Sean Silva,

It's now been confirmed!

Thank you as always.

Sincerely
Journeyer


2012/11/4 Sean Silva <silvas at purdue.edu>:
> Yes, the VarDecl is the AST node for the array declaration.
>
> -- Sean Silva
>
> On Fri, Nov 2, 2012 at 8:03 AM, Journeyer J. Joh
> <oosaprogrammer at gmail.com> wrote:
>> Hello list,
>>
>> I'd like to share my understanding and also want some review or
>> comment about it.
>> Let's say there is a function.
>>
>> ====================
>> int func()
>> {
>>   int array[3];
>>   return 0;
>> }
>> ====================
>>
>> I investigated how an AST node for the declaration of array above forms.
>>
>> 1. ConstantArrayType is registered into ASTContext (this Clang::Type
>> is distinguished by it's size(3) and type(int))
>> 2. a TypeSourceInfo is created with the clang::Type above (which is
>> registered in ASTContext) and the Locations(ArrayTypeLoc,
>> BuiltinTypeLoc)
>> 3. a VarDecl is created with the TypeSourceInfo above and the name of
>> the variable, ('array' this case)
>>
>> ?. So I think the VarDecl is itself the AST node for the array declaration!
>>
>> I am not sure especially for the one marked by '?'.
>>
>> I think all 'Decl's is itself is a node of AST. And I wonder if this is correct.
>>
>> Thank you very much!
>>
>> Also I wonder if this kind of question is not proper in this mail
>> list. If anyone think so let me know. I will stop asking this kind of
>> question here.
>>
>> Best regards
>> --
>> ----------------------------------------
>> 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



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