yaxunl added inline comments. ================ Comment at: lib/Frontend/InitPreprocessor.cpp:421 @@ +420,3 @@ + switch (LangOpts.OpenCLVersion) { + case 0: + case 100: ---------------- pxli168 wrote: > What is 0 stand for as OpenCLVersion, it seems the default OpenCLVersion if > we did not pass any -cl-std=CLXX is 100. > So maybe we did not need this case 0: There is a test test/Frontend/stdlang.c:
// RUN: %clang_cc1 -x cl -std=c99 -DOPENCL %s With this test, LangOpts.OpenCL is 1 but LangOpts.OpenCLVersion is 0. If we all agree that this test is invalid and -x cl can only be compiled with OpenCL language standard and the default one is OpenCL 1.0, I can fix that test first and then remove case 0 in this switch. ================ Comment at: lib/Frontend/InitPreprocessor.cpp:439 @@ +438,3 @@ + if (LangOpts.OpenCLVersion >= 110) + Builder.defineMacro("CL_VERSION_1_1", "110"); + if (LangOpts.OpenCLVersion >= 120) ---------------- pxli168 wrote: > These macros maybe need for all cl version, and in the header we should > compare __OPENCL_C_VERSION__ with CL_VERSION_2_0 instead of the integer 200 > in the header of http://reviews.llvm.org/D18369? Each OpenCL version only defines some of these macros by spec. In the header file `__OPENCL_C_VERSION__` can compare with 200 since the spec defines the integer value for `__OPENCL_C_VERSION__`. Comparing with CL_VERSION_2_0 requires checking CL_VERSION_2_0 is available first. I think probably I can define a macro #define _OPENCL20_AND_ABOVE defined(__OPENCL_C_VERSION__) and defined(CL_VERSION_2_0) and __OPENCL_C_VERSION__ >= 200 and then use this macro for conditioning 2.0 specific functions. http://reviews.llvm.org/D19071 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits