[libcxx-commits] [PATCH] D76636: [RFC] Added type trait to remove address space qualifier from type

Anastasia Stulova via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 26 05:55:40 PDT 2020

Anastasia added a comment.
Herald added a subscriber: broadwaylamb.

In D76636#1941590 <https://reviews.llvm.org/D76636#1941590>, @rjmccall wrote:

> In D76636#1941575 <https://reviews.llvm.org/D76636#1941575>, @Anastasia wrote:
> > In D76636#1940086 <https://reviews.llvm.org/D76636#1940086>, @rjmccall wrote:
> >
> > > Address spaces are actually defined in a number of standardized C extensions that are compatible with C++, such as the Embedded C specification, OpenCL, and so on.  There's precedent for libc++ accepting work that supports this kind of C++-compatible extension in the past; for example, `std::is_pointer` looks through Objective-C's ARC type qualifiers.  That said, (1) libc++ hasn't actually added new traits for such things before, just taught existing traits to handle them, and (2) I think this definition wouldn't actually work for cases like the OpenCL address spaces because they're not expressible as `__attribute__((address_space(N)))`.  (2) is fixable; (1) may be a reasonable place to draw the line on policy.
> >
> >
> > Regarding (2) (although it's probably not changing the major concerns) this exact implementation also works for OpenCL because we map the address space keywords to the attributes during the parsing. However, OpenCL currently doesn't support libcxx. :(
> Ah, okay.  Maybe it's one of the other languages that keeps its address spaces separate from `address_space`.
> Regardless, if libc++ wants to have a policy of not adding new features that cover non-C++ features, that's a reasonable stance.

This perfectly makes sense. However, we do have useful Clang extensions that need corresponding support in the libraries too. Particularly for address spaces we could add such functionality into an OpenCL specific headers and libs. It feels a bit unfortunate because the implementation in Clang is generic and therefore more areas could benefit from this feature. I don't know if we could consider to add some Clang extensions specific C++ libs... I understand that standardisation with ISO is valuabloe but it is not often a reality in the embedded world.

>   libc++ should consider whether is_pointer needs a workaround for stripping address-space qualifiers, though.

Yes, I see. I will look into this. Thanks!



More information about the libcxx-commits mailing list