[libcxx-commits] [libcxxabi] [libc++abi] Replace usage of raw assert by _LIBCXXABI_ASSERT (PR #80689)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 5 06:45:15 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxxabi
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
We strive not to use raw assert(...) anymore in libc++abi in preparation for using the hardening framework.
---
Full diff: https://github.com/llvm/llvm-project/pull/80689.diff
1 Files Affected:
- (modified) libcxxabi/src/private_typeinfo.cpp (+2-2)
``````````diff
diff --git a/libcxxabi/src/private_typeinfo.cpp b/libcxxabi/src/private_typeinfo.cpp
index 857ae25b7028d..5c68f3e994cd9 100644
--- a/libcxxabi/src/private_typeinfo.cpp
+++ b/libcxxabi/src/private_typeinfo.cpp
@@ -44,9 +44,9 @@
#include <cstdint>
#include <cassert>
#include <string.h>
+#include "abort_message.h"
#ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST
-#include "abort_message.h"
#include <sys/syslog.h>
#include <atomic>
#endif
@@ -470,7 +470,7 @@ __class_type_info::can_catch(const __shim_type_info* thrown_type,
if (thrown_class_type == 0)
return false;
// bullet 2
- assert(adjustedPtr && "catching a class without an object?");
+ _LIBCXXABI_ASSERT(adjustedPtr, "catching a class without an object?");
__dynamic_cast_info info = {thrown_class_type, 0, this, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, nullptr};
info.number_of_dst_type = 1;
thrown_class_type->has_unambiguous_public_base(&info, adjustedPtr, public_path);
``````````
</details>
https://github.com/llvm/llvm-project/pull/80689
More information about the libcxx-commits
mailing list