r232367 - [clang] Replacing asserts with static_asserts where appropriate

Gabor Horvath xazax.hun at gmail.com
Mon Mar 16 02:59:54 PDT 2015


Author: xazax
Date: Mon Mar 16 04:59:54 2015
New Revision: 232367

URL: http://llvm.org/viewvc/llvm-project?rev=232367&view=rev
Log:
[clang] Replacing asserts with static_asserts where appropriate

Summary: This patch consists of the suggestions of clang-tidy/misc-static-assert check.

Reviewers: alexfh

Subscribers: dblaikie, xazax.hun, cfe-commits

Differential Revision: http://reviews.llvm.org/D8344

Patch by Szabolcs Sipos!

Modified:
    cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=232367&r1=232366&r2=232367&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Mar 16 04:59:54 2015
@@ -1318,9 +1318,10 @@ ExprResult Sema::SemaAtomicOpsOverloaded
   //   M is C if C is an integer, and ptrdiff_t if C is a pointer, and
   //   the int parameters are for orderings.
 
-  assert(AtomicExpr::AO__c11_atomic_init == 0 &&
-         AtomicExpr::AO__c11_atomic_fetch_xor + 1 == AtomicExpr::AO__atomic_load
-         && "need to update code for modified C11 atomics");
+  static_assert(AtomicExpr::AO__c11_atomic_init == 0 &&
+                    AtomicExpr::AO__c11_atomic_fetch_xor + 1 ==
+                        AtomicExpr::AO__atomic_load,
+                "need to update code for modified C11 atomics");
   bool IsC11 = Op >= AtomicExpr::AO__c11_atomic_init &&
                Op <= AtomicExpr::AO__c11_atomic_fetch_xor;
   bool IsN = Op == AtomicExpr::AO__atomic_load_n ||





More information about the cfe-commits mailing list