[PATCH] Sema: reject probably incorrect atomic ordering requests

Tim Northover t.p.northover at gmail.com
Mon Mar 10 08:48:47 PDT 2014


Hi all,

The builtin atomic operations (up to now) have been a little unfriendly in simply not emitting anything if an invalid memory ordering is requested (e.g. "__c11_atomic_load(p, memory_order_release)").

This patch adds some Sema checking (to an error) if the operand is an integer-constant-expression and not permitted. It'll obviously still miss cases (since we apparently support non-constant arguments there), but hopefully it's an improvement to the current situation.

Does it look reasonable? My Clang is rather rusty.

Cheers.

Tim

http://llvm-reviews.chandlerc.com/D3027

Files:
  include/clang/AST/Expr.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/CGAtomic.cpp
  lib/Sema/SemaChecking.cpp
  test/CodeGen/atomic-ops.c
  test/CodeGen/big-atomic-ops.c
  test/Sema/atomic-ops.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3027.1.patch
Type: text/x-patch
Size: 9659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140310/0346cedd/attachment.bin>


More information about the cfe-commits mailing list