[libcxx-commits] [libcxx] [libc++][hardening] Add a greppable prefix to assertion messages. (PR #150560)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 24 17:59:03 PDT 2025


================
@@ -20,8 +20,8 @@
 #define _LIBCPP_ASSERT(expression, message)                                                                            \
   (__builtin_expect(static_cast<bool>(expression), 1)                                                                  \
        ? (void)0                                                                                                       \
-       : _LIBCPP_ASSERTION_HANDLER(__FILE__ ":" _LIBCPP_TOSTRING(__LINE__) ": assertion " _LIBCPP_TOSTRING(            \
-             expression) " failed: " message "\n"))
+       : _LIBCPP_ASSERTION_HANDLER(__FILE__ ":" _LIBCPP_TOSTRING(                                                      \
+             __LINE__) ": libc++ Hardening assertion " _LIBCPP_TOSTRING(expression) " failed: " message "\n"))
----------------
var-const wrote:

I'm very open to suggestions about how exactly to word the prefix. The `++` part in `libc++` is slightly annoying since it needs escaping in the regex (no big deal, just a slight annoyance) -- personally, I'd lean towards using `libcxx` for that reason, but happy with anything, really.

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


More information about the libcxx-commits mailing list