[cfe-dev] Declaration name qualifiers.

John McCall rjmccall at apple.com
Fri Mar 12 11:41:21 PST 2010


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'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.  It would be nice if there were a similar space-saving hack you could use there, but fast access to a class's DefinitionData is much more important than fast access to a declarator's TypeSourceInfo.  Maybe a side-table in the ASTContext?

(*)  By all measures.  Every scoped declaration necessarily has at least one unscoped previous declaration, headers contain primarily unscoped declarations, and local declarations are never scoped.

John.



More information about the cfe-dev mailing list