[cfe-dev] Better type-specifier representation
kremenek at apple.com
Fri Sep 12 16:25:18 PDT 2008
On Sep 12, 2008, at 4:17 PM, Argiris Kirtzidis wrote:
> These are good points, I agree. Putting type-spec info in the type
> is the wrong way to go.
> Daniel Dunbar wrote:
>> If we want to explicitly represent the type specifier, what is
>> wrong with
>> actually making this a separate node (not a Type and not a Decl).
>> We can
>> probably present the abstraction that the AST has TypeSpecifier nodes
>> without actually creating them (by encoding in DeclGroup or other
>> This also gives a clear place to attach source range, makes clear
>> what the
>> representation of sizeof(type) is (a SizeofAlignOfTypeExpr which
>> points to
>> a TypeSpecifier which in turn points to the type), and should make
> This is a great idea!
> How about using something like this:
> -In the AST, Decls do not have Types, they have TypeSpecifiers.
> Exprs have Types.
> -TypeSpecifiers can own RecordDecls
> -DeclGroups are used for declaration lists:
> int x,y,z; -> DeclGroup
> but not for parameters. If the ParmVarDecl has a TypeSpecifier, we
> don't have to use a DeclGroup in its place.
> Let me know what you think.
This sounds like the right approach to me!
The one outstanding grossness that I can think of right now is VLAs.
How should we represent:
int x[foo()][bar()][...], y;
Right now, the type for the VLA owns the expressions foo(), bar(), and
so on. Both DeclGroups and TypeSpecifiers don't solve this problem (I
More information about the cfe-dev