Several helper functions specify preconditions as comments, but we never
check them. I ran across a bug report (without a reproducer) in this code,
and I thought that having these assertions in place would make it easier
to troubleshoot.
Details
Details
- Reviewers
philnik - Group Reviewers
Restricted Project - Commits
- rG990ea3925b7a: [libc++] Add a few _LIBCPP_ASSERTs in __tree
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I think I would remove the comments, since the preconditions are now documented in code.
libcxx/include/__tree | ||
---|---|---|
345–346 | Could you also add that precondition? |
Comment Actions
Address comments.
libcxx/include/__tree | ||
---|---|---|
345–346 | I'll do that, but I'll add it as a _LIBCPP_DEBUG_ASSERT, since checking that invariant requires recursively visiting the whole tree AFAICT. _LIBCPP_ASSERT assertions should be cheap and should not impact complexity. |
Could you also add that precondition?