[libcxx-commits] [libcxx] 1e35e93 - [libc++] Disable tree invariant check in asserts mode
Hans Wennborg via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 4 06:42:30 PDT 2023
Author: Hans Wennborg
Date: 2023-07-04T15:36:15+02:00
New Revision: 1e35e93e30c25bf67d3038f3e227dc6be729743d
URL: https://github.com/llvm/llvm-project/commit/1e35e93e30c25bf67d3038f3e227dc6be729743d
DIFF: https://github.com/llvm/llvm-project/commit/1e35e93e30c25bf67d3038f3e227dc6be729743d.diff
LOG: [libc++] Disable tree invariant check in asserts mode
This is a follow-up to D153672 which removed the old debug mode and
moved many of those checks to the regular asserts mode.
The tree invariant check is too expensive for the regular asserts mode,
making element removal O(n) instead of O(log n), so disable it until
there is a new debug assert category it can be put in.
Differential revision: https://reviews.llvm.org/D154417
Added:
Modified:
libcxx/include/__tree
Removed:
################################################################################
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 78150ae4e93c1f..3ba9b7e74cf61b 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -376,7 +376,8 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
{
_LIBCPP_ASSERT_UNCATEGORIZED(__root != nullptr, "Root node should not be null");
_LIBCPP_ASSERT_UNCATEGORIZED(__z != nullptr, "The node to remove should not be null");
- _LIBCPP_ASSERT_UNCATEGORIZED(std::__tree_invariant(__root), "The tree invariants should hold");
+ // TODO: Use in the new debug mode:
+ // _LIBCPP_DEBUG_ASSERT(std::__tree_invariant(__root), "The tree invariants should hold");
// __z will be removed from the tree. Client still needs to destruct/deallocate it
// __y is either __z, or if __z has two children, __tree_next(__z).
// __y will have at most one child.
More information about the libcxx-commits
mailing list