qualifier_set ¶The two types described prior were designed to permit front-ends that do not support address space qualification to avoid incurring extra complexity for handling it, while also preventing mishandling address space qualifiers, if the frontend is ever to start supporting them.
Thus, a frontend can opt to avoid using qualifier_set, and stick
only with cv_qualifier in a way which allows a later change to
permit address space qualification.
To do so, implement a function, say lang_type_quals, that
returns cv_qualifier instead of qualifier_set, and use it
instead of TYPE_QUALS, that looks like:
cv_qualifier
lang_type_quals (const_tree type)
{
cv_qualifier quals;
addr_space_t as;
std::tie (quals, as) = TYPE_QUALS (type).split ();
/* No address space support yet. */
gcc_assert (ADDR_SPACE_GENERIC_P (as));
return quals;
}
then, you can use cv_qualifier in the rest of the frontend.
As a cv_qualifier can convert implicitly to a
qualifier_set, GCC core functions can accept cv_qualifier
values already.
If, at some point, your frontend gains support for address space
qualification, it suffices to update this function to return
qualifier_set and then fix the ensuing compiler errors.
Because qualifier_set lacks those operations of
cv_qualifier that require extra work, each place where extra work
is now needed will be diagnosed at compile time.