The addition of a new attribute ext_address_space that supplements the existing address_space attribute by allowing dependent integers to be used in conjunction with address spaces. It takes a lot of inspiration from the existing ext_vector_type attribute which similarly allows the acceptance of dependent integer values. This addition allows address spaces to be used in conjunction with templates like the following basic function:
template <unsigned Nv>
int get_as(int attribute((ext_address_space(Nv))) *) {
return Nv;
}
This modification requires the addition of a new attribute ext_address_space and a new type DependentExtAddressSpaceType, alongside the relevant boiler plate code required for these new additions. Such as case statements for template deduction and name mangling. The ext_ part of the attribute name is following the naming convention of ext_vector_type, as it currently extends the existing address_space attributes functionality. The DependentExtAddressSpaceType is a new type for storing the dependent address space integer passed to it and the type it's to be attached to. DependentExtAddressSpaceType is based on ext_vector_type's DependentSizedExtVectorType, so future modifications to this type could also be considered for DependentExtAddressSpaceType. One large example is the addition of a more specific type location class.
There is one difference between the ext_vector_type and ext_address_space attributes and it's that ext_address_space can be used outside of using and typedef declarations.
The handling of the ext_address_space attribute inside SemaType.cpp is similar to the address_space attribute and aims to emit the same diagnostic errors and functionality that it does. In fact it would be possible to integrate the both of them. However, I did not wish to during my implementation of this functionality in-case it had adverse effects.
Why is this called PointerType? An address space qualifier goes on the pointee type.
That question applies to a lot of this patch.