[Atomics] warn about atomic accesses using libcalls
authorTim Northover <tnorthover@apple.com>
Mon, 23 Apr 2018 08:16:24 +0000 (08:16 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 23 Apr 2018 08:16:24 +0000 (08:16 +0000)
commit9dc1d0c74eb1f566ef20e307b0cdda1f79d4cbee
tree5a8cedadab811c489ac6d8cff61641098286319a
parent1b6d3744229f6953bad081c5b80fce91e4913731
[Atomics] warn about atomic accesses using libcalls

If an atomic variable is misaligned (and that suspicion is why Clang emits
libcalls at all) the runtime support library will have to use a lock to safely
access it, with potentially very bad performance consequences. There's a very
good chance this is unintentional so it makes sense to issue a warning.

Also give it a named group so people can promote it to an error, or disable it
if they really don't care.

llvm-svn: 330566
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/CodeGen/CGAtomic.cpp
clang/test/CodeGen/atomics-sema-alignment.c [new file with mode: 0644]