[PATCH] D43305: Convert an assert to a static_assert. NFC.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 11:33:07 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD325158: Convert an assert to a static_assert. NFC. (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43305?vs=134270&id=134280#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43305

Files:
  COFF/Symbols.h
  ELF/Symbols.h
  wasm/Symbols.h


Index: COFF/Symbols.h
===================================================================
--- COFF/Symbols.h
+++ COFF/Symbols.h
@@ -421,8 +421,8 @@
   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
Index: wasm/Symbols.h
===================================================================
--- wasm/Symbols.h
+++ wasm/Symbols.h
@@ -242,8 +242,8 @@
   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)...);
 }
 
Index: ELF/Symbols.h
===================================================================
--- ELF/Symbols.h
+++ ELF/Symbols.h
@@ -355,8 +355,8 @@
   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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43305.134280.patch
Type: text/x-patch
Size: 1757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180214/d1b2b340/attachment.bin>


More information about the llvm-commits mailing list