[libcxx-commits] [libcxx] [libc++][hardening] Introduce a dylib function to log hardening errors. (PR #148266)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 11 11:42:54 PDT 2025
================
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___LOG_HARDENING_FAILURE
+#define _LIBCPP___LOG_HARDENING_FAILURE
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// This function should never be called directly from the code -- it should only be called through the
+// `_LIBCPP_LOG_HARDENING_FAILURE` macro.
+_LIBCPP_AVAILABILITY_LOG_HARDENING_FAILURE _LIBCPP_OVERRIDABLE_FUNC_VIS void
+__libcpp_log_hardening_failure(const char* message) _NOEXCEPT;
----------------
ldionne wrote:
```suggestion
__log_hardening_failure(const char* message) _NOEXCEPT;
```
I don't think we need to name it `__libcpp_foo`. I think the reason I originally named it `__libcpp_verbose_abort` was to put it in the global namespace and to make it easy for people to override using a strong definition -- I needed a name that wouldn't conflict in the global namespace. Since this doesn't apply here, I think we should remove `__libcpp`.
https://github.com/llvm/llvm-project/pull/148266
More information about the libcxx-commits
mailing list