https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/243530
>From 605a2577ef4aedd23a3bda3cdb69ae3f018c1ec6 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser <[email protected]> Date: Tue, 17 Nov 2026 17:40:38 +0100 Subject: [PATCH] [libc++abi] Make the dst_type uniqueness flag in dynamic_cast a bool --- libcxxabi/src/private_typeinfo.cpp | 11 +++++------ libcxxabi/src/private_typeinfo.h | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libcxxabi/src/private_typeinfo.cpp b/libcxxabi/src/private_typeinfo.cpp index 84503c520503b..7e5c7b657fe84 100644 --- a/libcxxabi/src/private_typeinfo.cpp +++ b/libcxxabi/src/private_typeinfo.cpp @@ -180,7 +180,7 @@ const void* dyn_cast_to_derived( 0, 0, true, - 1, // number_of_dst_type + true, // has_unique_dst_type false, false}; // Do the search @@ -215,10 +215,9 @@ const void* dyn_cast_to_derived( 0, 0, true, - 0, + true, // has_unique_dst_type false, false}; - info.number_of_dst_type = 1; res = dst_type->search_above_dst<true>(&info, dynamic_ptr, dynamic_ptr, path_kind::public_path); } #endif // _LIBCXXABI_FORGIVING_DYNAMIC_CAST @@ -270,7 +269,7 @@ const void* dyn_cast_try_downcast( 0, 0, true, - 1, // number_of_dst_type + true, // has_unique_dst_type false, false}; result res = @@ -927,7 +926,7 @@ result __class_type_info::process_static_type_above_dst( info->has_path_to_static_ptr = true; // If there is only one dst_type in the entire tree and the path from // there to here is public then we are done! - return info->number_of_dst_type == 1 && info->path_dst_ptr_to_static_ptr == path_kind::public_path + return info->has_unique_dst_type && info->path_dst_ptr_to_static_ptr == path_kind::public_path ? result::success : result::unknown; } else if (info->dst_ptr_leading_to_static_ptr == dst_ptr) { @@ -936,7 +935,7 @@ result __class_type_info::process_static_type_above_dst( info->path_dst_ptr_to_static_ptr = path_below; // If there is only one dst_type in the entire tree and the path from // there to here is public then we are done! - return info->number_of_dst_type == 1 && info->path_dst_ptr_to_static_ptr == path_kind::public_path + return info->has_unique_dst_type && info->path_dst_ptr_to_static_ptr == path_kind::public_path ? result::success : result::unknown; } else { diff --git a/libcxxabi/src/private_typeinfo.h b/libcxxabi/src/private_typeinfo.h index 1435ab61aac14..83a083c6eda7b 100644 --- a/libcxxabi/src/private_typeinfo.h +++ b/libcxxabi/src/private_typeinfo.h @@ -108,8 +108,8 @@ struct _LIBCXXABI_HIDDEN __dynamic_cast_info { // Data that helps stop the search before the entire tree is searched: bool dst_type_might_be_derived_from_static_type; - // Number of dst_type in tree. If 0, then that means unknown. - int number_of_dst_type; + // Whether we know that there is a unique dst_type in the graph. + bool has_unique_dst_type; // communicates to a dst_type node that (static_ptr, static_type) was found // above it. bool found_our_static_ptr; _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
