pub struct RecordInfo {
pub kind: RecordKind,
pub tag: Option<Symbol>,
pub layout: Option<Layout>,
pub variable: Option<VariableLayout>,
pub fields: Vec<Field>,
pub transparent: bool,
pub reverse: bool,
}Expand description
What is known about one struct or union declaration.
Fields§
§kind: RecordKindWhether it is a struct or a union.
tag: Option<Symbol>The tag, absent for an anonymous one.
layout: Option<Layout>The layout, absent until the members have been seen and laid out.
This is also what says whether the type is complete. A record is incomplete from the point its tag is first mentioned until its closing brace, and code in between may declare pointers to it and nothing else.
For a record with a member of no fixed size the alignment here is the right one and the
size is zero, since an alignment never depends on a length. RecordInfo::variable is
what holds the size in that case and what says the size here means nothing.
variable: Option<VariableLayout>How long the record is and where its members sit, where those are not numbers.
Present on exactly the records C calls variably modified, meaning a variable length array is somewhere among the members, which may only be written inside a function.
fields: Vec<Field>The members, placed, and empty until the record is complete.
One entry per member the program wrote, in that order, so a caller that kept the declarations can index the two together.
transparent: boolWhether __attribute__((transparent_union)) was written on it and held up.
Only ever true of a union, and only of one whose first member is the size and the
alignment of the whole of it, which is what makes passing the union and passing that
member the same thing at a call. What it buys is two rules: a parameter of this type is
compatible with a parameter of any member’s type, and a value assigned to it is put into
whichever member it fits. Both are in spec/13-gnu-compat.md.
reverse: boolWhether the scalars in it are stored in the byte order the target does not have.
What __attribute__((scalar_storage_order("big-endian"))) on a little-endian target asks
for, and what the same attribute written with the target’s own order does not. It changes
nothing about where the members sit: the record is the size and the alignment it would
otherwise be and every member is at the offset it would otherwise be at. What it changes
is the order of the bytes inside each scalar, which is a byte swap on every load and
store, and the end of a storage unit a bit-field is allocated from. Both are in
spec/13-gnu-compat.md.