This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <__hash_table>
ClosedPublic

Authored by philnik on Jan 1 2022, 4:28 PM.

Details

Summary

Use _LIBCPP_DEBUG_ASSERT in <__hash_table>

Diff Detail

Event Timeline

philnik requested review of this revision.Jan 1 2022, 4:28 PM
philnik created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 1 2022, 4:28 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

LGTM but as usual please wait for green CI (and a second approver).

Mordante accepted this revision.Jan 2 2022, 8:39 AM

LGTM.

libcxx/include/__hash_table
2488–2489

In this case I have a slight preference to keep the original code, since it doesn't remove the #if. But I won't object against the change.

This revision is now accepted and ready to land.Jan 2 2022, 8:39 AM
philnik added inline comments.Jan 2 2022, 8:45 AM
libcxx/include/__hash_table
2488–2489

I found it much easier to read the code because you have the

#if _LIBCPP_DEBUG_LEVEL == 2
  do_something();
#else
  do_essentially_the_same_thing();
#endif

all over this file, but almost never any assertions in the if block. Now you never have assertions in the same #if block.

Mordante added inline comments.Jan 2 2022, 8:54 AM
libcxx/include/__hash_table
2488–2489

I hadn't looked at the entire file. But I see what you mean. Then let's keep your changes.

ldionne accepted this revision.Jan 3 2022, 1:33 PM

I really like these changes, thanks for cleaning this up.

This revision was automatically updated to reflect the committed changes.