[libcxx-commits] [libcxx] [libc++][hardening] Add an experimental function to log hardening errors (PR #149452)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 23 02:21:42 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions ,cpp -- libcxx/include/__log_hardening_failure libcxx/src/experimental/log_hardening_failure.cpp libcxx/test/libcxx/assertions/log_hardening_failure.pass.cpp libcxx/include/__config libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/src/experimental/log_hardening_failure.cpp b/libcxx/src/experimental/log_hardening_failure.cpp
index f85e5d58d..3655c8510 100644
--- a/libcxx/src/experimental/log_hardening_failure.cpp
+++ b/libcxx/src/experimental/log_hardening_failure.cpp
@@ -27,7 +27,7 @@ void __log_hardening_failure(const char* message) noexcept {
std::fputs(message, stderr);
// On Apple platforms, use the `os_fault_with_payload` OS function that simulates a crash.
-# if defined(__APPLE__) && __has_include(<os/reason_private.h>) && !TARGET_OS_SIMULATOR
+#if defined(__APPLE__) && __has_include(<os/reason_private.h>) && !TARGET_OS_SIMULATOR
os_fault_with_payload(
/*reason_namespace=*/OS_REASON_SECURITY,
/*reason_code=*/0,
@@ -36,7 +36,7 @@ void __log_hardening_failure(const char* message) noexcept {
/*reason_string=*/message,
/*reason_flags=*/0);
-# elif defined(__BIONIC__)
+#elif defined(__BIONIC__)
// Show error in tombstone.
android_set_abort_message(message);
@@ -44,7 +44,7 @@ void __log_hardening_failure(const char* message) noexcept {
openlog("libc++", 0, 0);
syslog(LOG_CRIT, "%s", message);
closelog();
-# endif
+#endif
}
_LIBCPP_END_NAMESPACE_STD
``````````
</details>
https://github.com/llvm/llvm-project/pull/149452
More information about the libcxx-commits
mailing list