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

require host toolchains which support this.

llvm-svn: 202640
This commit is contained in:
Chandler Carruth 2014-03-02 13:02:01 +00:00
parent 867ea1d426
commit 06dde92cd6
3 changed files with 11 additions and 11 deletions

View File

@ -52,7 +52,7 @@
namespace clang { namespace clang {
namespace ast_matchers { namespace ast_matchers {
/// TODO: Use LLVM_STATIC_ASSERT() instead of this. /// TODO: Use static_assert instead of this.
template <bool> struct CompileAssert {}; template <bool> struct CompileAssert {};
#define TOOLING_COMPILE_ASSERT(Expr, Msg) LLVM_ATTRIBUTE_UNUSED \ #define TOOLING_COMPILE_ASSERT(Expr, Msg) LLVM_ATTRIBUTE_UNUSED \
typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1] typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

View File

@ -915,23 +915,23 @@ class CallEventManager {
template <typename T, typename Arg> template <typename T, typename Arg>
T *create(Arg A, ProgramStateRef St, const LocationContext *LCtx) { T *create(Arg A, ProgramStateRef St, const LocationContext *LCtx) {
LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy), static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
"CallEvent subclasses are not all the same size"); "CallEvent subclasses are not all the same size");
return new (allocate()) T(A, St, LCtx); return new (allocate()) T(A, St, LCtx);
} }
template <typename T, typename Arg1, typename Arg2> template <typename T, typename Arg1, typename Arg2>
T *create(Arg1 A1, Arg2 A2, ProgramStateRef St, const LocationContext *LCtx) { T *create(Arg1 A1, Arg2 A2, ProgramStateRef St, const LocationContext *LCtx) {
LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy), static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
"CallEvent subclasses are not all the same size"); "CallEvent subclasses are not all the same size");
return new (allocate()) T(A1, A2, St, LCtx); return new (allocate()) T(A1, A2, St, LCtx);
} }
template <typename T, typename Arg1, typename Arg2, typename Arg3> template <typename T, typename Arg1, typename Arg2, typename Arg3>
T *create(Arg1 A1, Arg2 A2, Arg3 A3, ProgramStateRef St, T *create(Arg1 A1, Arg2 A2, Arg3 A3, ProgramStateRef St,
const LocationContext *LCtx) { const LocationContext *LCtx) {
LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy), static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
"CallEvent subclasses are not all the same size"); "CallEvent subclasses are not all the same size");
return new (allocate()) T(A1, A2, A3, St, LCtx); return new (allocate()) T(A1, A2, A3, St, LCtx);
} }
@ -939,8 +939,8 @@ class CallEventManager {
typename Arg4> typename Arg4>
T *create(Arg1 A1, Arg2 A2, Arg3 A3, Arg4 A4, ProgramStateRef St, T *create(Arg1 A1, Arg2 A2, Arg3 A3, Arg4 A4, ProgramStateRef St,
const LocationContext *LCtx) { const LocationContext *LCtx) {
LLVM_STATIC_ASSERT(sizeof(T) == sizeof(CallEventTemplateTy), static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
"CallEvent subclasses are not all the same size"); "CallEvent subclasses are not all the same size");
return new (allocate()) T(A1, A2, A3, A4, St, LCtx); return new (allocate()) T(A1, A2, A3, A4, St, LCtx);
} }

View File

@ -60,8 +60,8 @@ MacroInfo *Preprocessor::AllocateMacroInfo(SourceLocation L) {
MacroInfo *Preprocessor::AllocateDeserializedMacroInfo(SourceLocation L, MacroInfo *Preprocessor::AllocateDeserializedMacroInfo(SourceLocation L,
unsigned SubModuleID) { unsigned SubModuleID) {
LLVM_STATIC_ASSERT(llvm::AlignOf<MacroInfo>::Alignment >= sizeof(SubModuleID), static_assert(llvm::AlignOf<MacroInfo>::Alignment >= sizeof(SubModuleID),
"alignment for MacroInfo is less than the ID"); "alignment for MacroInfo is less than the ID");
DeserializedMacroInfoChain *MIChain = DeserializedMacroInfoChain *MIChain =
BP.Allocate<DeserializedMacroInfoChain>(); BP.Allocate<DeserializedMacroInfoChain>();
MIChain->Next = DeserialMIChainHead; MIChain->Next = DeserialMIChainHead;