[PATCH] D47618: __c11_atomic_load's _Atomic can be const

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 23 08:27:39 PDT 2018


yaxunl added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:3368-3374
   } else if (Form != Load && Form != LoadCopy) {
     if (ValType.isConstQualified()) {
       Diag(DRE->getLocStart(), diag::err_atomic_op_needs_non_const_pointer)
         << Ptr->getType() << Ptr->getSourceRange();
       return ExprError();
     }
   }
----------------
jfb wrote:
> rsmith wrote:
> > It would be a little nicer to change this `else if` to a plain `if` and conditionalize the diagnostic instead.
> > 
> > Can you track down whoever added the address space check to the C11 atomic path and ask them if they really meant for it to not apply to the GNU atomic builtins?
> It was @yaxunl in https://reviews.llvm.org/D28691
> Nobody asked about GNU atomic builtins with OpenCL in that review. I'll let @yaxunl chime in.
Your change LGTM. Originally the check for constant addr space was introduced to match the check of C11 for const. OpenCL itself does not have this restriction.


Repository:
  rC Clang

https://reviews.llvm.org/D47618





More information about the cfe-commits mailing list