r202640 - [C++11] Switch from LLVM_STATIC_ASSERT to static_assert now that we

Chandler Carruth chandlerc at gmail.com
Sun Mar 2 05:02:01 PST 2014


Author: chandlerc
Date: Sun Mar  2 07:02:01 2014
New Revision: 202640

URL: http://llvm.org/viewvc/llvm-project?rev=202640&view=rev
Log:
[C++11] Switch from LLVM_STATIC_ASSERT to static_assert now that we
require host toolchains which support this.

Modified:
    cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
    cfe/trunk/lib/Lex/PPDirectives.cpp

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=202640&r1=202639&r2=202640&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Sun Mar  2 07:02:01 2014
@@ -52,7 +52,7 @@
 namespace clang {
 namespace ast_matchers {
 
-/// TODO: Use LLVM_STATIC_ASSERT() instead of this.
+/// TODO: Use static_assert instead of this.
 template <bool> struct CompileAssert {};
 #define TOOLING_COMPILE_ASSERT(Expr, Msg) LLVM_ATTRIBUTE_UNUSED \
   typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h?rev=202640&r1=202639&r2=202640&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h Sun Mar  2 07:02:01 2014
@@ -915,23 +915,23 @@ class CallEventManager {
 
   template <typename T, typename Arg>
   T *create(Arg A, ProgramStateRef St, const LocationContext *LCtx) {
-    LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy),
-                       "CallEvent subclasses are not all the same size");
+    static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
+                  "CallEvent subclasses are not all the same size");
     return new (allocate()) T(A, St, LCtx);
   }
 
   template <typename T, typename Arg1, typename Arg2>
   T *create(Arg1 A1, Arg2 A2, ProgramStateRef St, const LocationContext *LCtx) {
-    LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy),
-                       "CallEvent subclasses are not all the same size");
+    static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
+                  "CallEvent subclasses are not all the same size");
     return new (allocate()) T(A1, A2, St, LCtx);
   }
 
   template <typename T, typename Arg1, typename Arg2, typename Arg3>
   T *create(Arg1 A1, Arg2 A2, Arg3 A3, ProgramStateRef St,
             const LocationContext *LCtx) {
-    LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy),
-                       "CallEvent subclasses are not all the same size");
+    static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
+                  "CallEvent subclasses are not all the same size");
     return new (allocate()) T(A1, A2, A3, St, LCtx);
   }
 
@@ -939,8 +939,8 @@ class CallEventManager {
             typename Arg4>
   T *create(Arg1 A1, Arg2 A2, Arg3 A3, Arg4 A4, ProgramStateRef St,
             const LocationContext *LCtx) {
-    LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy),
-                       "CallEvent subclasses are not all the same size");
+    static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
+                  "CallEvent subclasses are not all the same size");
     return new (allocate()) T(A1, A2, A3, A4, St, LCtx);
   }
 

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=202640&r1=202639&r2=202640&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Sun Mar  2 07:02:01 2014
@@ -60,8 +60,8 @@ MacroInfo *Preprocessor::AllocateMacroIn
 
 MacroInfo *Preprocessor::AllocateDeserializedMacroInfo(SourceLocation L,
                                                        unsigned SubModuleID) {
-  LLVM_STATIC_ASSERT(llvm::AlignOf<MacroInfo>::Alignment >= sizeof(SubModuleID),
-                     "alignment for MacroInfo is less than the ID");
+  static_assert(llvm::AlignOf<MacroInfo>::Alignment >= sizeof(SubModuleID),
+                "alignment for MacroInfo is less than the ID");
   DeserializedMacroInfoChain *MIChain =
       BP.Allocate<DeserializedMacroInfoChain>();
   MIChain->Next = DeserialMIChainHead;





More information about the cfe-commits mailing list