How to parse a record bitmask field in plugin?

Wed Jan 27 05:27:00 GMT 2016

Each member of 'Something' is a 'FIELD_DECL' and the corresponding
documentation states, "If DECL_C_BIT_FIELD holds, this field is a bit-field.
In a bit-field, DECL_BIT_FIELD_TYPE also contains the type that was
originally specified for it..." After updating my code to check for
'DECL_C_BIT_FIELD', I see it holds. Then using 'DECL_BIT_FIELD_TYPE' gets a
tree node on which 'TYPE_NAME' returns a valid node from which to get
'unsigned int'.

crasypantz wrote
> I am having difficulty getting the type name of an integer bit mask field.
> For example:
> struct Something {
>     unsigned int unmasked;
>     unsigned int masked:7;
> }
> Both field tree nodes for 'Something' have 'INTEGER_TYPE ==
> TREE_CODE(node)'. For the 'unmasked' node I use 'TYPE_NAME(node)' to get
> the type name 'unsigned int'. However, 'TREE_NAME' on the 'masked' node
> returns null. How can I get the type name? I searched the archive and
> cannot find anything related to the question. Hopefully I have not
> overlooked something previously posted.
> Again, your help is appreciated.

View this message in context:
Sent from the gcc - Help mailing list archive at

More information about the Gcc-help mailing list