]> granicus.if.org Git - clang/commit
__c11_atomic_load's _Atomic can be const
authorJF Bastien <jfbastien@apple.com>
Thu, 2 Aug 2018 17:35:46 +0000 (17:35 +0000)
committerJF Bastien <jfbastien@apple.com>
Thu, 2 Aug 2018 17:35:46 +0000 (17:35 +0000)
commitba544795b8a361f7261f47b0b875ecdb4a90fe24
tree3eadd8e7cdd0de9abcff5d71bde18915797bc6a4
parentdb084703129164e127aa93a5a55f81a2d8e1d4da
__c11_atomic_load's _Atomic can be const

Summary:
C++11 onwards specs the non-member functions atomic_load and atomic_load_explicit as taking the atomic<T> by const (potentially volatile) pointer. C11, in its infinite wisdom, decided to drop the const, and C17 will fix this with DR459 (the current draft forgot to fix B.16, but that’s not the normative part).

clang’s lib/Headers/stdatomic.h implements these as #define to the __c11_* equivalent, which are builtins with custom typecheck. Fix the typecheck.

D47613 takes care of the libc++ side.

Discussion: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058129.html

<rdar://problem/27426936>

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D47618

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338743 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaChecking.cpp
test/Sema/atomic-ops.c
test/SemaOpenCL/atomic-ops.cl