[llvm] dc7834b - [ProfileData] Use static_assert instead of assert (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 28 23:13:26 PDT 2024


Author: Kazu Hirata
Date: 2024-04-28T23:13:18-07:00
New Revision: dc7834b76c187bdf3b260c66445b750ed8d99507

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

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

Identified with misc-static-assert.

Added: 
    

Modified: 
    llvm/lib/ProfileData/InstrProfWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index e1846fcbffee52..b61c59aacc0f95 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -657,8 +657,8 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
                        : IndexedInstrProf::ProfVersion::CurrentVersion;
   // The WritePrevVersion handling will either need to be removed or updated
   // if the version is advanced beyond 12.
-  assert(IndexedInstrProf::ProfVersion::CurrentVersion ==
-         IndexedInstrProf::ProfVersion::Version12);
+  static_assert(IndexedInstrProf::ProfVersion::CurrentVersion ==
+                IndexedInstrProf::ProfVersion::Version12);
   if (static_cast<bool>(ProfileKind & InstrProfKind::IRInstrumentation))
     Header.Version |= VARIANT_MASK_IR_PROF;
   if (static_cast<bool>(ProfileKind & InstrProfKind::ContextSensitive))


        


More information about the llvm-commits mailing list