This change adds extra cast operator addrspace_cast described earlier in this RFC:
http://lists.llvm.org/pipermail/cfe-dev/2018-December/060546.html
This operator is intended for casting between pointers to objects in different address spaces and follows similar logic as const_cast in C++.
Example:
int* gen = ...; global int* gl = addrspace_cast<global int*>(gen);
Note that functionality of casting pointers to different address spaces has been previously removed from all other cast operators and can only be currently done using C style casts.
This commit only enables this change for OpenCL, but if agreed it can be changed to apply to C++ too (it needs to be enabled as a valid keyword). However, for C++ it might need to be added as a Clang only extension?
Hi Anastasia, apologies for not catching this earlier, but libclang is intended to keep a stable ABI and changing the enumerator values breaks libclang's ABI compatibility.
Would you be able to make a follow-up commit and restore the enumerator values to their original values? I would suggest to add CXCursor_CXXAddrspaceCastExpr at the end and assign to it the next available value that is not already taken.