Visitor used to recursively traverse MIR types and evaluate FFI-safety.
It uses check_* methods as entrypoints to be called elsewhere,
and visit_* methods to recurse.
Annotates whether we are in the context of an item defined in rust
and exposed to an FFI boundary,
or the context of an item from elsewhere, whose interface is re-declared in rust.
The uses_power_alignment lint detects specific repr(C)
aggregates on AIX.
In its platform C ABI, AIX uses the βpowerβ (as in PowerPC) alignment
rule (detailed in https://www.ibm.com/docs/en/xl-c-and-cpp-aix/16.1?topic=data-using-alignment-modes#alignment),
which can also be set for XLC by #pragma align(power) or
-qalign=power. Aggregates with a floating-point type as the
recursively first field (as in βat offset 0β) modify the layout of
subsequent fields of the associated structs to use an alignment value
where the floating-point type is aligned on a 4-byte boundary.
Check a struct definition for respect of the Power alignment Rule (as in PowerPC),
which should be respected in the βaixβ target OS.
To do so, we must follow one of the two following conditions:
A common pattern in this lint is to attempt normalize_erasing_regions,
but keep the original type if it were to fail.
This may or may not be supported in the logic behind the Unnormalized wrapper,
(FIXME?)
but it should be enough for non-wrapped types to be as normalised as this lint needs them to be.
The result when a type has been checked but perhaps not completely. None indicates that
FFI safety/unsafety has not yet been determined, Some(res) indicates that the safety/unsafety
in the FfiResult is final.