[llvm] 2d5eb67 - [Support] Use static_assert instead of assert (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 22:47:09 PST 2021


Author: Kazu Hirata
Date: 2021-02-18T22:46:41-08:00
New Revision: 2d5eb67235c763898f7c3327fb97b1ae1307d8e4

URL: https://github.com/llvm/llvm-project/commit/2d5eb67235c763898f7c3327fb97b1ae1307d8e4
DIFF: https://github.com/llvm/llvm-project/commit/2d5eb67235c763898f7c3327fb97b1ae1307d8e4.diff

LOG: [Support] Use static_assert instead of assert (NFC)

Identified with misc-static-assert.

Added: 
    

Modified: 
    llvm/lib/Support/SHA256.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/SHA256.cpp b/llvm/lib/Support/SHA256.cpp
index a3a6af2e7eff..3b81506847ec 100644
--- a/llvm/lib/Support/SHA256.cpp
+++ b/llvm/lib/Support/SHA256.cpp
@@ -204,7 +204,7 @@ void SHA256::update(ArrayRef<uint8_t> Data) {
   // Fast buffer filling for large inputs.
   while (Data.size() >= BLOCK_LENGTH) {
     assert(InternalState.BufferOffset == 0);
-    assert(BLOCK_LENGTH % 4 == 0);
+    static_assert(BLOCK_LENGTH % 4 == 0, "");
     constexpr size_t BLOCK_LENGTH_32 = BLOCK_LENGTH / 4;
     for (size_t I = 0; I < BLOCK_LENGTH_32; ++I)
       InternalState.Buffer.L[I] = support::endian::read32be(&Data[I * 4]);


        


More information about the llvm-commits mailing list