[PATCH] D109150: [OpenCL] Disallows static kernel functions in C++ for OpenCL
Justas Janickas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 6 05:04:55 PDT 2021
Topotuna added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:9972
// OpenCL v1.2 s6.8 static is invalid for kernel functions.
- if ((getLangOpts().OpenCLVersion >= 120)
- && (SC == SC_Static)) {
+ if ((getLangOpts().getOpenCLCompatibleVersion() >= 120) &&
+ (SC == SC_Static)) {
----------------
Anastasia wrote:
> I wonder though if we should just drop a version check here completely.
>
> I don't think we can allow this in the earlier OpenCL versions. The reason why it doesn't apply to earlier versions is that `static`/`extern` wasn't allowed at all so presumably frontend would reject such a case earlier.
>
> I think the extra check is not doing anything useful here, but only adds extra code to read and maintain.
That is correct. If `static` or `extern` is used in OpenCL C 1.0, diagnostic `err_opencl_unknown_type_specifier` is displayed before control flow reaches this part of code. And so removing the check here doesn't seem to change the compiler behaviour.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109150/new/
https://reviews.llvm.org/D109150
More information about the cfe-commits
mailing list