Author: Anton Zabaznov Date: 2021-07-13T18:47:29+03:00 New Revision: 03d8fed34951bc6e92b36615ec3afe6f36d10de6
URL: https://github.com/llvm/llvm-project/commit/03d8fed34951bc6e92b36615ec3afe6f36d10de6 DIFF: https://github.com/llvm/llvm-project/commit/03d8fed34951bc6e92b36615ec3afe6f36d10de6.diff LOG: [OpenCL] Add verbosity when checking support of read_write images Parenthesis were fixed incorrectly by D105890 Reviewed By: Anastasia Differential Revision: https://reviews.llvm.org/D105892 Added: Modified: clang/lib/Sema/SemaDeclAttr.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index a5d0597e39c4..3586ad323b8e 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -7402,14 +7402,17 @@ static void handleOpenCLAccessAttr(Sema &S, Decl *D, const ParsedAttr &AL) { // OpenCL v3.0 s6.8 - For OpenCL C 2.0, or with the // __opencl_c_read_write_images feature, image objects specified as arguments // to a kernel can additionally be declared to be read-write. + // C++ for OpenCL inherits rule from OpenCL C v2.0. if (const auto *PDecl = dyn_cast<ParmVarDecl>(D)) { const Type *DeclTy = PDecl->getType().getCanonicalType().getTypePtr(); if (AL.getAttrName()->getName().find("read_write") != StringRef::npos) { - if (((!S.getLangOpts().OpenCLCPlusPlus && - (S.getLangOpts().OpenCLVersion < 200)) || - (S.getLangOpts().OpenCLVersion == 300 && - !S.getOpenCLOptions().isSupported("__opencl_c_read_write_images", - S.getLangOpts()))) || + bool ReadWriteImagesUnsupportedForOCLC = + (S.getLangOpts().OpenCLVersion < 200) || + (S.getLangOpts().OpenCLVersion == 300 && + !S.getOpenCLOptions().isSupported("__opencl_c_read_write_images", + S.getLangOpts())); + if ((!S.getLangOpts().OpenCLCPlusPlus && + ReadWriteImagesUnsupportedForOCLC) || DeclTy->isPipeType()) { S.Diag(AL.getLoc(), diag::err_opencl_invalid_read_write) << AL << PDecl->getType() << DeclTy->isImageType(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits