[gcc plugin] get member offset in struct just like offsetof
Eric Botcazou
ebotcazou@adacore.com
Tue Feb 6 16:58:00 GMT 2018
> I am writing a gcc plugin for parsing the structure fields. But I have the
> problem how to get the offset of each field in the struct? Just like the
> offsetof macro in gcc.
>
> I see DECL_FIELD_OFFSET in tree.h, but the result seems not right.
The offset in bits/bytes is given by tree.c:bit_position/byte_position.
--
Eric Botcazou
More information about the Gcc
mailing list