[PATCH] D109370: [OpenCL] Enables .rgba vector extension in C++ for OpenCL 2021
Justas Janickas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 14 05:06:20 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG09dc454b00b8: [OpenCL] Enables .rgba vector extension in C++ for OpenCL 2021 (authored by Topotuna).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109370/new/
https://reviews.llvm.org/D109370
Files:
clang/lib/Sema/SemaExprMember.cpp
clang/test/SemaOpenCL/ext_vectors.cl
Index: clang/test/SemaOpenCL/ext_vectors.cl
===================================================================
--- clang/test/SemaOpenCL/ext_vectors.cl
+++ clang/test/SemaOpenCL/ext_vectors.cl
@@ -2,6 +2,7 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++1.0
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021
typedef float float4 __attribute__((ext_vector_type(4)));
@@ -9,13 +10,13 @@
V = V.wzyx;
V = V.abgr;
-#if (__OPENCL_C_VERSION__ < 300)
+#if ((defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 300) || (defined(__OPENCL_CPP_VERSION__) && __OPENCL_CPP_VERSION__ < 202100))
// expected-warning at -2 {{vector component name 'a' is a feature from OpenCL version 3.0 onwards}}
#endif
V = V.xyzr;
// expected-error at -1 {{illegal vector component name 'r'}}
-#if (__OPENCL_C_VERSION__ < 300)
+#if ((defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 300) || (defined(__OPENCL_CPP_VERSION__) && __OPENCL_CPP_VERSION__ < 202100))
// expected-warning at -3 {{vector component name 'r' is a feature from OpenCL version 3.0 onwards}}
#endif
}
Index: clang/lib/Sema/SemaExprMember.cpp
===================================================================
--- clang/lib/Sema/SemaExprMember.cpp
+++ clang/lib/Sema/SemaExprMember.cpp
@@ -340,7 +340,8 @@
// Emit a warning if an rgba selector is used earlier than OpenCL C 3.0.
if (HasRGBA || (*compStr && IsRGBA(*compStr))) {
- if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion < 300) {
+ if (S.getLangOpts().OpenCL &&
+ S.getLangOpts().getOpenCLCompatibleVersion() < 300) {
const char *DiagBegin = HasRGBA ? CompName->getNameStart() : compStr;
S.Diag(OpLoc, diag::ext_opencl_ext_vector_type_rgba_selector)
<< StringRef(DiagBegin, 1) << SourceRange(CompLoc);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109370.372458.patch
Type: text/x-patch
Size: 1989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210914/55c809e6/attachment.bin>
More information about the cfe-commits
mailing list