Anastasia added inline comments.
================
Comment at: lib/Frontend/InitPreprocessor.cpp:426
@@ +425,3 @@
+ case 110:
+ Builder.defineMacro("__CLANG_OPENCL_C_VERSION__", "110");
+ break;
----------------
So why we can't use unified __OPENCL_C_VERSION__?
================
Comment at: lib/Frontend/InitPreprocessor.cpp:438
@@ +437,3 @@
+ Builder.defineMacro("CL_VERSION_1_0", "100");
+ if (LangOpts.OpenCLVersion >= 110)
+ Builder.defineMacro("CL_VERSION_1_1", "110");
----------------
I am not sure we should add this conditionally though. If you want to compile
CL code like this (forcing pointer to point to private AS for all CL versions
the code is compiled for):
#if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
private void* priv_ptr;
#else
void* priv_ptr;
#endif
This code would fail with -cl-sdt=CL1.1 (because CL_VERSION_2_0 is no longer
defined), but the purpose of having version macros is to be able to condition
on the passed CL version in the particular compilation run to avoid the
compiler failure/miscompilation. This way we provide a way to select the right
CL code for all versions the code is being compiled (if such selection is
needed) to allow portability of CL code among OpenCL version.
http://reviews.llvm.org/D19071
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits