It's a draft for the patch we discussed in the thread of opaque pointer support in the SPIR-V translator. The final decision on whether we will use this approach has not yet been made, so the patch is uploaded for convenience and concertizing of the discussion.
The types are already in metadata for kernel functions by default. Alexey Bader shared the code example with non-kernel functions which lost the info. The patch fixes this case. To enable the feature you need to pass -cl-extra-ptr-info to clang.
TODO:
- emit only ptr type info metadata if EmitOpenCLExtraPtrInfo is enabled,
- maybe add the same info to function declarations,
- maybe add the same options to other languages (SYCL, HLSL ...) or make one common option for all languages.