]> granicus.if.org Git - clang/commit
Make atomic non-member functions as nonnull
authorJF Bastien <jfbastien@apple.com>
Fri, 25 May 2018 00:07:09 +0000 (00:07 +0000)
committerJF Bastien <jfbastien@apple.com>
Fri, 25 May 2018 00:07:09 +0000 (00:07 +0000)
commit956d9d40ee4e56da887d6fbb92ccea1b9dc2cdf7
tree66879cb66a4a4cfab452c84d659c1a295357d5f9
parentbfc08965afd670796a4428cf84d170c05e64ef6b
Make atomic non-member functions as nonnull

Summary:
As a companion to libc++ patch https://reviews.llvm.org/D47225, mark builtin atomic non-member functions which accept pointers as nonnull.

The atomic non-member functions accept pointers to std::atomic / std::atomic_flag as well as to the non-atomic value. These are all dereferenced unconditionally when lowered, and therefore will fault if null. It's a tiny gotcha for new users, especially when they pass in NULL as expected value (instead of passing a pointer to a NULL value).

<rdar://problem/18473124>

Reviewers: arphaman

Subscribers: aheejin, cfe-commits

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

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