[lld] r325158 - Convert an assert to a static_assert. NFC.

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 11:28:47 PST 2018


Author: sbc
Date: Wed Feb 14 11:28:46 2018
New Revision: 325158

URL: http://llvm.org/viewvc/llvm-project?rev=325158&view=rev
Log:
Convert an assert to a static_assert. NFC.

Differential Revision: https://reviews.llvm.org/D43305

Modified:
    lld/trunk/COFF/Symbols.h
    lld/trunk/ELF/Symbols.h
    lld/trunk/wasm/Symbols.h

Modified: lld/trunk/COFF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.h?rev=325158&r1=325157&r2=325158&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.h (original)
+++ lld/trunk/COFF/Symbols.h Wed Feb 14 11:28:46 2018
@@ -421,8 +421,8 @@ void replaceSymbol(Symbol *S, ArgT &&...
   static_assert(sizeof(T) <= sizeof(SymbolUnion), "Symbol too small");
   static_assert(alignof(T) <= alignof(SymbolUnion),
                 "SymbolUnion not aligned enough");
-  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
-         "Not a Symbol");
+  static_assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr,
+                "Not a Symbol");
   new (S) T(std::forward<ArgT>(Arg)...);
 }
 } // namespace coff

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=325158&r1=325157&r2=325158&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Wed Feb 14 11:28:46 2018
@@ -355,8 +355,8 @@ void replaceSymbol(Symbol *S, ArgT &&...
   static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
   static_assert(alignof(T) <= alignof(SymbolUnion),
                 "SymbolUnion not aligned enough");
-  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
-         "Not a Symbol");
+  static_assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr,
+                "Not a Symbol");
 
   Symbol Sym = *S;
 

Modified: lld/trunk/wasm/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Symbols.h?rev=325158&r1=325157&r2=325158&view=diff
==============================================================================
--- lld/trunk/wasm/Symbols.h (original)
+++ lld/trunk/wasm/Symbols.h Wed Feb 14 11:28:46 2018
@@ -242,8 +242,8 @@ T *replaceSymbol(Symbol *S, ArgT &&... A
   static_assert(sizeof(T) <= sizeof(SymbolUnion), "Symbol too small");
   static_assert(alignof(T) <= alignof(SymbolUnion),
                 "SymbolUnion not aligned enough");
-  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
-         "Not a Symbol");
+  static_assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr,
+                "Not a Symbol");
   return new (S) T(std::forward<ArgT>(Arg)...);
 }
 




More information about the llvm-commits mailing list