[libcxx-commits] [libcxx] [libc++][hardening] Add an experimental function to log hardening errors (PR #149452)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 22 04:23:25 PDT 2025


================
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <__config>
+#include <__log_hardening_failure>
+#include <cstdio>
+
+#ifdef __BIONIC__
+#  include <syslog.h>
+extern "C" void android_set_abort_message(const char* msg);
+#endif // __BIONIC__
+
+#if defined(__APPLE__) && __has_include(<os/reason_private.h>)
+#  include <TargetConditionals.h>
+#  include <os/reason_private.h>
+#endif
+
+#if _LIBCPP_HAS_EXPERIMENTAL_HARDENING_OBSERVE_SEMANTIC
----------------
philnik777 wrote:

I don't think this guard is needed.

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


More information about the libcxx-commits mailing list