[libc++] Rename *SAFE_STATIC to *CONSTINIT, and normalize its uses.

In src/, most files can use `constinit` directly because they're always
compiled with C++20. But some files, like "libcxxabi/src/fallback_malloc.cpp",
can't, because they're `#include`d directly from test cases in libcxxabi/test/
and therefore must (currently) compile as C++03. We might consider refactoring
those offending tests, or at least marking them `UNSUPPORTED: c++03`.

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

NOKEYCHECK=True
GitOrigin-RevId: 05337a756c6606fdbf2c0ff3a8399da3e60f1591
diff --git a/src/cxa_default_handlers.cpp b/src/cxa_default_handlers.cpp
index e0ccbe1..b6ce058 100644
--- a/src/cxa_default_handlers.cpp
+++ b/src/cxa_default_handlers.cpp
@@ -20,8 +20,7 @@
 
 #if !defined(LIBCXXABI_SILENT_TERMINATE)
 
-_LIBCPP_SAFE_STATIC
-static const char* cause = "uncaught";
+static constinit const char* cause = "uncaught";
 
 __attribute__((noreturn))
 static void demangling_terminate_handler()
@@ -100,13 +99,13 @@
 // Global variables that hold the pointers to the current handler
 //
 _LIBCXXABI_DATA_VIS
-_LIBCPP_SAFE_STATIC std::terminate_handler __cxa_terminate_handler = default_terminate_handler;
+constinit std::terminate_handler __cxa_terminate_handler = default_terminate_handler;
 
 _LIBCXXABI_DATA_VIS
-_LIBCPP_SAFE_STATIC std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler;
+constinit std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler;
 
 _LIBCXXABI_DATA_VIS
-_LIBCPP_SAFE_STATIC std::new_handler __cxa_new_handler = 0;
+constinit std::new_handler __cxa_new_handler = nullptr;
 
 namespace std
 {
diff --git a/src/cxa_guard_impl.h b/src/cxa_guard_impl.h
index 5a7cbfd..72940cc 100644
--- a/src/cxa_guard_impl.h
+++ b/src/cxa_guard_impl.h
@@ -619,7 +619,7 @@
   static T instance;
 };
 template <class T>
-_LIBCPP_SAFE_STATIC T GlobalStatic<T>::instance = {};
+_LIBCPP_CONSTINIT T GlobalStatic<T>::instance = {};
 
 enum class Implementation { NoThreads, GlobalMutex, Futex };
 
diff --git a/src/fallback_malloc.cpp b/src/fallback_malloc.cpp
index 7e356d9..1d6c380 100644
--- a/src/fallback_malloc.cpp
+++ b/src/fallback_malloc.cpp
@@ -33,10 +33,9 @@
 
 // When POSIX threads are not available, make the mutex operations a nop
 #ifndef _LIBCXXABI_HAS_NO_THREADS
-_LIBCPP_SAFE_STATIC
-static std::__libcpp_mutex_t heap_mutex = _LIBCPP_MUTEX_INITIALIZER;
+static _LIBCPP_CONSTINIT std::__libcpp_mutex_t heap_mutex = _LIBCPP_MUTEX_INITIALIZER;
 #else
-static void* heap_mutex = 0;
+static _LIBCPP_CONSTINIT void* heap_mutex = 0;
 #endif
 
 class mutexor {