[PATCH] D47229: Make atomic non-member functions as nonnull

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 22 14:43:16 PDT 2018


jfb created this revision.
jfb added a reviewer: arphaman.
Herald added subscribers: cfe-commits, aheejin.

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


Repository:
  rC Clang

https://reviews.llvm.org/D47229

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/atomic-ops.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47229.148104.patch
Type: text/x-patch
Size: 16152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180522/f84fd170/attachment.bin>


More information about the cfe-commits mailing list