[cfe-dev] Declaration name qualifiers.

John McCall rjmccall at apple.com
Mon Mar 15 03:14:32 PDT 2010


On Mar 13, 2010, at 6:50 AM, Enea Zaffanella wrote:

> Douglas Gregor wrote:
>> On Mar 12, 2010, at 2:41 PM, John McCall wrote:
>>> On Mar 12, 2010, at 1:38 AM, Enea Zaffanella wrote:
>>>> <Qualifier.patch>
>>> I'm not okay with adding 2-3 pointers to every DeclaratorDecl for
>>> what's an uncommon case(*) even in C++.  Please use a QualType-like
>>> hack here;  that is to say, please make the DeclInfo field a
>>> PointerUnion<TypeSourceInfo*,UncommonData*> where UncommonData is a
>>> private struct holding the qualifier information (and the
>>> TypeSourceInfo*, of course).
>> I agree.
> >
>>> I'm pretty sure you don't need this in TagDecl;  I don't think
>>> enums can be declared out-of-line, so it could be pushed down to
>>> CXXRecordDecl at least.
>> C++0x allows forward declarations (and, therefore, out-of-line
>> definitions) of enums, and it's also a GNU extension. So we do need
>> this in TagDecl.
>> - Doug
> 
> Please find attached the patch revised as suggested.

Thanks!  This looks very nice;  committed as r98540 with a few tweaks.

> We now use internal ExtInfo structures in both DeclaratorDecl and in TagDecl nodes. In the latter, the ExtInfo structure only contains info about the name qualifier; it is stored in a PointerUnion with the old TypedefForAnonDecl* field, since they could not occur together.

Very nice;  I'd forgotten about that field on TagDecl.

John.



More information about the cfe-dev mailing list