My SOC project is going to be to rework attributes to make them very easy to work with. In particular, it should be very straightforward to add new attributes to clang.
I will be creating a definitions file (probably tablegen-based) with each of the attributes, including information such as what they can apply to, what arguments they accept, and any other pertinent information. This information should be sufficient for clang to handle most of the things needed for the attribute, including:
- Creating a new subtype of Attr to hold the attribute
- Parsing the attribute and its arguments, in any form in which the
attribute is accepted
- Putting the attribute into the AST attached to the correct object
- Serializing/deserializing the attribute through a precompiled header
- Performing a number of semantic checks, such as the attribute
applying to the correct kind of declaration.
Once the attribute is added to the AST, other uses of the attribute will probably remain mostly the same.
Does anyone have any comments about this?