[libc++][hardening] Introduce assertion semantics. (#149459)

Assertion semantics closely mimic C++26 Contracts evaluation semantics.
This brings our implementation closer in line with C++26 Library Hardening
(one particular benefit is that using the `observe` semantic makes adopting
hardening easier for projects).

NOKEYCHECK=True
GitOrigin-RevId: 3eee9fc2c4d1973904b1a26fa96a8c7473ef6a5e
diff --git a/src/demangle/DemangleConfig.h b/src/demangle/DemangleConfig.h
index a88e6ce..79dbeb8 100644
--- a/src/demangle/DemangleConfig.h
+++ b/src/demangle/DemangleConfig.h
@@ -19,6 +19,14 @@
 #include "../abort_message.h"
 #endif
 
+#ifndef _LIBCPP_LOG_HARDENING_FAILURE
+// Libc++abi does not have any functionality to log and continue, so we drop
+// error messages when we build the demangler with `observe` assertion semantic.
+// Once the layering with libc++ is improved, this could use the libc++
+// functionality to log hardening failures.
+#define _LIBCPP_LOG_HARDENING_FAILURE(message) ((void)0)
+#endif
+
 #include <version>
 
 #ifdef _MSC_VER