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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 14:52:01 PDT 2016


rsmith added inline comments.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7900
@@ -7897,1 +7899,3 @@
+def err_opencl_ext_vector_type_rgba_selector: Error<
+  "vector component name '%0' cannot be used earlier than OpenCL version 2.2">;
 } // end of sema category
----------------
I don't see any good reason to reject this in earlier versions of OpenCL. Clang has its own extensions and is not beholden to the OpenCL spec's notion of extensions in this regard. Generally, wherever reasonable, we support features from later versions of a language as extensions in earlier versions.

However, since "extension" means something in the OpenCL specification, we could say "OpenCL 2.2 feature" rather than "OpenCL 2.2 extension" in the ExtWarn message.

================
Comment at: lib/Sema/SemaExprMember.cpp:337-339
@@ +336,5 @@
+      if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion < 220) {
+        const char *diagBegin = HasRGBA ? CompName->getNameStart() : compStr;
+        S.Diag(OpLoc, diag::err_opencl_ext_vector_type_rgba_selector)
+          << StringRef(diagBegin, 1)
+          << S.getLangOpts().OpenCLVersion << SourceRange(CompLoc);
----------------
diagBegin -> DiagBegin


http://reviews.llvm.org/D20602





More information about the cfe-commits mailing list