If you don’t write C++ code using FIDL low-level bindings, you can stop reading.
TL;DR
Several generated constants describing properties of generated LLCPP structs, tables, and unions will be moved from being nested directly in the struct to being in a specialization of the template fidl::TypeTraits<T>.
No Action Required
You do not need to update existing code in . I will fix all existing code, however if you have a LLCPP CL in progress, it might break after rebasing.
Background
Currently, LLCPP generated types (structs, tables, unions) contain the following generated constants:
MaxNumHandles is a uint32_t specifying the upper bound on the number of contained handles.
PrimarySize is a uint32_t specifying the size in bytes of the inline part of the message.
MaxOutOfLine is a uint32_t specifying the upper bound on the out-of-line message size. It is std::numeric_limits<uint32_t>::max() if T is unbounded.
HasPointer is a boolean specifying if the structure contains pointer indirections, hence requires linearization when sending.
Type is a fidl_type_t* pointing to the corresponding coding table, if any. If the encoding/decoding of T can be elided, Type is nullptr.
Additionally, if T is a transactional message:
HasFlexibleEnvelope is a bool specifying if this message contains a flexible union or a flexible table.
MessageKind identifies if this message is a request or a response. If undefined, the type may be used either as a request or a response.
Because these constants are defined directly on the FIDL type, they can potentially conflict with user defined types.
This change moves these generated constants to a specialization of the newly added fidl::TypeTraits<T> struct. It also renames them to be prefixed with ‘k’ to match the C++ style guide.
So:
FidlType::MaxNumHandles becomes fidl::TypeTraits<FidlType>::kMaxNumHandles
FidlType::PrimarySize becomes fidl::TypeTraits<FidlType>::kPrimarySize
FidlType::MaxOutOfLine becomes fidl::TypeTraits<FidlType>::kMaxOutOfLine
FidlType::HasPointer becomes fidl::TypeTraits<FidlType>::kHasPointer
FidlType::Type becomes fidl::TypeTraits<FidlType>::kType
FidlType::HasFlexibleEnvelope becomes fidl::TypeTraits<FidlType>::kHasFlexibleEnvelope