[PATCH] D104915: [OpenCL] Add support of __opencl_c_read_write_images feature macro

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 13 06:31:43 PDT 2021


thakis added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:7412
+            !S.getOpenCLOptions().isSupported("__opencl_c_read_write_images",
+                                              S.getLangOpts()))) ||
           DeclTy->isPipeType()) {
----------------
Are the parens right here? You probably want

  `!S.getLangOpts().OpenCLCPlusPlus && (Ver < 200 || (Ver == 300 && isSupported))`

for the first term, but you have

  `!S.getLangOpts().OpenCLCPlusPlus && (Ver < 200) || (Ver == 300 && isSupported)`

Which means the OpenCLCPlusPlus only matters for `(Ver < 200)` and the `(Ver == 300 && ...)` term makes things true independent of the OpenCLCPlusPlus check.

If what you currently have is what you want: Remove the parens around `(S.getLangOpts().OpenCLVersion < 200)` and do instead parenthesize like so: `(!S.getLangOpts().OpenCLCPlusPlus && Ver < 200)`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104915/new/

https://reviews.llvm.org/D104915



More information about the cfe-commits mailing list