[libcxx-commits] [libcxx] [libcxxabi] [libc++][hardening] Introduce assertion semantics (PR #148268)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 14 11:46:41 PDT 2025


================
@@ -260,6 +266,60 @@ output. This is less secure and increases the size of the binary (among other
 things, it has to store the error message strings) but makes the failure easier
 to debug. It also allows testing the error messages in our test suite.
 
+This default behavior can be customized by users via :ref:`assertion semantics
+<assertion-semantics>`; it can also be completely overridden by vendors by
+providing a :ref:`custom assertion failure handler
+<override-assertion-handler>`.
+
+.. _assertion-semantics:
+
+Assertion semantics
----------------
ldionne wrote:

General comment: we need to mention (or at least plan for) what happens when C++26 Contracts are implemented. In particular, there will be a time when Clang and libc++ will implement Contracts and the Contracts runtime (`class std::contract_violation`, etc). Furthermore, we'll want libc++ to be a valid C++26 _Hardened Implementation_, which requires that hardening failures be treated as contract violations.

When that's the case, what should happen with `_LIBCPP_ASSERTION_SEMANTIC`?

https://github.com/llvm/llvm-project/pull/148268


More information about the libcxx-commits mailing list