[cfe-dev] Decls are not synonyms for the symbols they represent

Ted Kremenek kremenek at apple.com
Tue Sep 16 21:30:09 PDT 2008

On Sep 16, 2008, at 9:05 PM, Argiris Kirtzidis wrote:

> Ted Kremenek wrote:
>> My understanding was that with the combination of TypeSpecifiers  
>> and DeclGroups, TranslationUnit would no longer have any direct  
>> reference to a RecordDecl (and thus never own it).  Isn't this true?
> Ah, never mind, I was under the impression that it was going to be  
> something like this:
> int x; -> DeclGroup
> struct y; -> RecordDecl
> but it will actually be like this ?:
> int x; -> DeclGroup
> struct y; -> DeclGroup
> is this correct?

I think so.  In this case, the common-case optimization would be to  
have a DeclGroup just refer to a single Decl, but the idea is at the  
top-level (the translation unit) you have a set of DeclGroups, each  
which have a collection of Decls.  This way clients are always forced  
to think about either groups of decls or individual decls in the  
proper contexts.

More information about the cfe-dev mailing list