[cfe-dev] Adding more info to builtin source types.

Enea Zaffanella zaffanella at cs.unipr.it
Sat Jan 16 06:05:43 PST 2010


Douglas Gregor wrote:

[...]

> I actually like the idea of using 3 bits to say which of 
> type/signedness/width were specified in the type, then just making sure 
> that the SourceLocation points to something that makes sense... the type 
> specifier location if it's there, otherwise the signedness or width 
> location. That gives us a lot more information in the AST without 
> costing much at all.

[...]

> Ah, okay. Let's not worry about the source range; a single *useful* 
> location is good enough.

Here is a revised patch.

We store a single location for all builtin types where you cannot write 
a width/sign specifier (void, char16, etc.).

For the others builtins, we have additional 4 bytes that are used to 
store a total of 10 bits (instead of the 3 mentioned above): we found 
that out initial analysis was incomplete in that we were not 
considering, e.g., the possibility of having a 'mode' attribute 
specifying the width of the builtin. Hence now we store:
  - the TST (5 bits), TSW (2 bits) and TSS (2 bits) fields
    **before** these are modified by the semantic analysis done
    in DeclSpec::Finish();
  - in the 10th bit, whether or not the ModeAttr was given
    **before** this is taken away by TakeAttributes().

Cheers,
Enea Zaffanella.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BuiltinTypeLoc.patch
Type: text/x-patch
Size: 11816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100116/dbe69783/attachment.bin>


More information about the cfe-dev mailing list