[PATCH] D99969: [OpenCL] Accept .rgba in OpenCL 3.0
Sven van Haastregt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 12 01:30:35 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG731bf28a6092: [OpenCL] Accept .rgba in OpenCL 3.0 (authored by svenvh).
Changed prior to commit:
https://reviews.llvm.org/D99969?vs=335557&id=336773#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99969/new/
https://reviews.llvm.org/D99969
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
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
@@ -1,11 +1,20 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
typedef float float4 __attribute__((ext_vector_type(4)));
void test_ext_vector_accessors(float4 V) {
V = V.wzyx;
- V = V.abgr; // expected-warning {{vector component name 'a' is an OpenCL version 2.2 feature}}
- V = V.xyzr; // expected-warning {{vector component name 'r' is an OpenCL version 2.2 feature}} \
- // expected-error {{illegal vector component name 'r'}}
+
+ V = V.abgr;
+#if (__OPENCL_C_VERSION__ < 300)
+ // expected-warning at -2 {{vector component name 'a' is an OpenCL C version 3.0 feature}}
+#endif
+
+ V = V.xyzr;
+ // expected-error at -1 {{illegal vector component name 'r'}}
+#if (__OPENCL_C_VERSION__ < 300)
+ // expected-warning at -3 {{vector component name 'r' is an OpenCL C version 3.0 feature}}
+#endif
}
Index: clang/lib/Sema/SemaExprMember.cpp
===================================================================
--- clang/lib/Sema/SemaExprMember.cpp
+++ clang/lib/Sema/SemaExprMember.cpp
@@ -338,13 +338,12 @@
compStr++;
} while (*compStr && (Idx = vecType->getPointAccessorIdx(*compStr)) != -1);
- // Emit a warning if an rgba selector is used earlier than OpenCL 2.2
+ // 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 < 220) {
+ if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion < 300) {
const char *DiagBegin = HasRGBA ? CompName->getNameStart() : compStr;
S.Diag(OpLoc, diag::ext_opencl_ext_vector_type_rgba_selector)
- << StringRef(DiagBegin, 1)
- << S.getLangOpts().OpenCLVersion << SourceRange(CompLoc);
+ << StringRef(DiagBegin, 1) << SourceRange(CompLoc);
}
}
} else {
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10005,9 +10005,9 @@
def err_opencl_builtin_expected_type : Error<
"illegal call to %0, expected %1 argument type">;
-// OpenCL v2.2 s2.1.2.3 - Vector Component Access
+// OpenCL v3.0 s6.3.7 - Vector Components
def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
- "vector component name '%0' is an OpenCL version 2.2 feature">,
+ "vector component name '%0' is an OpenCL C version 3.0 feature">,
InGroup<OpenCLUnsupportedRGBA>;
def err_openclcxx_placement_new : Error<
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99969.336773.patch
Type: text/x-patch
Size: 2913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210412/03646f48/attachment-0001.bin>
More information about the cfe-commits
mailing list