jhuber6 wrote:

> > I agree in general that C/C++ has no semantic meaning ascribed to address 
> > spaces.
> 
> Err, C does. Please see TR 18037 
> (https://standards.iso.org/ittf/PubliclyAvailableStandards/c051126_ISO_IEC_TR_18037_2008.zip)
> 
> AIUI, we've extended the C extension into C++, so we should be following the 
> C semantics while mapping them on to C++'s stronger type system as closely as 
> we can.

Interesting, though reading through that I didn't see any mentions of implicit 
casts. It's simply stating that they can do casting if the target lists them as 
a subset. However, that would mean that the program passing sema would be 
dependent on the target machine. I'm actually not opposed to that, we could 
tear out the `isAddrSpaceSuperSetOf` check to allow it to keep a reference to 
the `TargetMachine` when making its decisions.

Also it's worth noting that in the documentation it has stuff like `__X char x, 
y, z` is a warning in `clang` due to how type level attributes work 
https://godbolt.org/z/Pfv36nEdq.

Maybe someone who reads better standardese than me can help with this. My 
ultimate goal is to make this legal when targeting NVPTX or AMDGPU, which is 
easily done by stating that `DefaultAS` is a superset of these other AS's. Let 
me know if making this target dependent is a good idea.
```c
void *foo(void [[clang::addrspace(3) *p) { return p; }
```

https://github.com/llvm/llvm-project/pull/115777
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to