[PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed May 25 15:38:03 PDT 2016


rsmith added a comment.

Looks good other than the recent information about the version of OpenCL that actually specifies this.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7899
@@ +7898,3 @@
+// OpenCL v2.2 s2.1.2.3 - Vector Component Access
+def warn_opencl_ext_vector_type_rgba_selector: Warning <
+  "vector component name '%0' is not part of OpenCL 2.0 and earlier">;
----------------
This should be an `ExtWarn`, not a `Warning`, and should be named `ext_...`. That way we'll reject it under `-cl-std=CL2.0 -pedantic-errors`.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7900
@@ -7897,1 +7899,3 @@
+def warn_opencl_ext_vector_type_rgba_selector: Warning <
+  "vector component name '%0' is not part of OpenCL 2.0 and earlier">;
 } // end of sema category
----------------
I think the result of the discussion was that this is added in OpenCL 2.2. The way we phrase this in other diagnostics is:

  "vector component name '%0' is an OpenCL 2.2 extension"

================
Comment at: lib/Sema/SemaExprMember.cpp:334-336
@@ +333,5 @@
+
+    // Emit a warning if an rgba selector is used in OpenCL 2.0 and below.
+    if (HasRGBA || (*compStr && IsRGBA(*compStr))) {
+      if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion <= 200) {
+        const char *diagBegin = HasRGBA ? CompName->getNameStart() : compStr;
----------------
This should presumably be `OpenCLVersion < 220`.


http://reviews.llvm.org/D20602





More information about the cfe-commits mailing list