Add attributes to Types (as found in Decl)

(Forwarding to cfe-dev, per Ted's advice)

I was trying to implement the transparent_union type attribute, but I
think
we need some additional API to handle it. I think we should add the
attribute API as found in Decl to Type (i.e. addAttr(), getAttrs(), ...).
This could be used to implement this attribute and all the others type
attributes
(Type Attributes - Using the GNU Compiler Collection (GCC)).
Alternatively we could just add an ad-hoc field to the RecordType struct
to
record if it's a transparent union or not, which also makes sense.

Please give me some feedback.

Hi Nuno,

I think this is possible to do. The 'problem' with this is that types are uniqued, so we have to think carefully about how attributes mix with this. I think the only sane solution is to have some canonical ordering of attribute lists and have the attribute list be part of the type.

What do you think?

-Chris

Well I really didn't remember of that issue. We can have two identical types, but one is e.g. deprecated and the other isn't.. And 2 types may be identical but have different aligments, so my ASTContext proposal doesn't seem valid either.
So I think your solution may be the best one as far as I can tell. I'll try to cook up some patch somewhere before the end of July :slight_smile: (yes, I'm overloaded with work..)

Thanks,
Nuno