[cfe-dev] Normalizing the AST across languages

Argiris Kirtzidis akyrtzi at gmail.com
Thu Oct 30 15:43:04 PDT 2008


Doug Gregor wrote:
> Okay, good. Now, I see that CXXFieldDecls are not ScopedDecls, but
> that's something we'll need to change, right? For example:
>
>   class C {
>     int m;
>     decltype(m) n;
>   };
>   

CXXFieldDecls don't have to be ScopedDecls, they already carry their 
parent DeclContext (the class they belong to)
and this is enough for name lookup to find them.

> So I assume that CXXFieldCollector will either be extended to support
> other kinds of members (member types, member functions, etc.) or that
> there will be similar collectors for those other kinds of members
> (CXXMethodCollector, etc.)?
>   

The way I saw it, as far as the AST is concerned, the instance fields of 
C++ classes would be found in the 'members' array (like C structs),
and the other member declarations (nested types, methods, static data 
members, all are ScopedDecls) would be found through a declaration chain 
of their parent DeclContext (their class),
similar to how file scope declarations will be chained to the 
DeclContext of a namespace.

Do you think this is sufficient or should something like 
CXXRecordDefInfo allocate extra space to hold all the member declarations ?

-Argiris



More information about the cfe-dev mailing list