[compiler-rt] 38371a1 - [rtsan][NFC] Make Uninitialzed state explicit (#109856)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 13:08:37 PDT 2024


Author: Chris Apple
Date: 2024-09-24T13:08:33-07:00
New Revision: 38371a1855dd891fdd0a6cf437e7c25b80f36dfe

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

LOG: [rtsan][NFC] Make Uninitialzed state explicit (#109856)

Follow on to #109830 

There should be no functional change, as enums start at 0 anyway. This
just makes the code more readable and prevents any future bugs.

Added: 
    

Modified: 
    compiler-rt/lib/rtsan/rtsan.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/rtsan/rtsan.cpp b/compiler-rt/lib/rtsan/rtsan.cpp
index e6d2481b2c2a3d..84e4b8fae1e2fa 100644
--- a/compiler-rt/lib/rtsan/rtsan.cpp
+++ b/compiler-rt/lib/rtsan/rtsan.cpp
@@ -31,7 +31,8 @@ enum class InitializationState : u8 {
 } // namespace
 
 static StaticSpinMutex rtsan_inited_mutex;
-static atomic_uint8_t rtsan_initialized = {0};
+static atomic_uint8_t rtsan_initialized = {
+    static_cast<u8>(InitializationState::Uninitialized)};
 
 static void SetInitializationState(InitializationState state) {
   atomic_store(&rtsan_initialized, static_cast<u8>(state),


        


More information about the llvm-commits mailing list