[PATCH] D91531: [RFC][OpenCL] Provide mechanisms for defining extension macros
Anton Zabaznov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 23 09:28:11 PST 2020
azabaznov added a comment.
> Perhaps if you give me an example it would help to understand
I was meant that this can potentially be used to undefine macros inside clang directly. In this case there will no need to add a lot of conditional preprocessor directives in the header, also the existing interface (`-cl-ext=-cl_khr_depth_images`) will be preserved. So for example in the header there was specified an extension definition. Can undef directive be allocated and bound to a specific source location right after extension definition if `-cl-ext=-cl_khr_depth_images` was specifed:
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0) || \
(__OPENCL_C_VERSION__ >= CL_VERSION_1_2 && defined(__SPIR__) )
#define cl_khr_depth_images 1
#endif
// Bind undef directive here
I understand that this sounds tricky, but preserving interface sound reasonable for me.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91531/new/
https://reviews.llvm.org/D91531
More information about the cfe-commits
mailing list