As discussed in https://reviews.llvm.org/D69938#inline-629726 this commit improves the diagnostic of addr spaces. The approach is currently reusing diagnostic streaming of Qualifiers.
There are a number of issues however:
- Address spaces don't always have representation i.e. in C++ it is just a number or Default address space doesn't correspond to anything at all. For the former case with the current approach we will get '__attribute__((address_space(N)))' printed into the diagnostic. For the latter one it will print unqualified.
- In OpenCL we threat __private and Default in the same way and therefore it doesn't get printed. With this patch therefore unqualified will appear even if __private was specified in the original source. There is a bug open to fix that however: https://bugs.llvm.org/show_bug.cgi?id=43295. Perhaps it should be fixed as soon as this gets committed.
I think you need to move "address space" into the diagnostic rendering for ak_addrspace so that you can say "generic address space" instead of "address space generic".