[libcxx-commits] [libcxxabi] 58f3a77 - [libc++abi] Replace usage of raw assert by _LIBCXXABI_ASSERT (#80689)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 5 08:21:31 PST 2024


Author: Louis Dionne
Date: 2024-02-05T11:21:27-05:00
New Revision: 58f3a77efb633d56a48e031240fc8a37ba2b7557

URL: https://github.com/llvm/llvm-project/commit/58f3a77efb633d56a48e031240fc8a37ba2b7557
DIFF: https://github.com/llvm/llvm-project/commit/58f3a77efb633d56a48e031240fc8a37ba2b7557.diff

LOG: [libc++abi] Replace usage of raw assert by _LIBCXXABI_ASSERT (#80689)

We strive not to use raw assert(...) anymore in libc++abi in preparation
for using the hardening framework.

Added: 
    

Modified: 
    libcxxabi/src/private_typeinfo.cpp

Removed: 
    


################################################################################
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);


        


More information about the libcxx-commits mailing list