This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by philnik on Jan 10 2022, 6:51 AM.

Details

Summary

Use _LIBCPP_DEBUG_ASSERT in <list>

Diff Detail

Event Timeline

philnik requested review of this revision.Jan 10 2022, 6:51 AM
philnik created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2022, 6:51 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

LGTM once my comment on lines 2007–2008 is addressed. Thanks, this is good cleanup!

libcxx/include/list
1435–1437

I just wanted to call out that personally I dislike the old code's style of breaking a string literal randomly in the middle, because it means that if I get that error message and grep to find where it was generated — git grep 'iterator not referring to this list' — I would have gotten no results. Putting the message all on one line like you just did is the Right Way because it is greppable. :)

1975–1976

Consider leaving this string message (all in one literal but) on the next line. I.e. don't change lines 2007–2008 at all, I think is what I'm saying, right?

2063–2064

Consider s/_LIBCPP_ASSERT/_LIBCPP_DEBUG_ASSERT/ on this line. IIUC, the change should have no effect, because this entire loop is guarded under _LIBCPP_DEBUG_LEVEL == 2 already; but it would be more self-documenting — this is still a "debug-mode assertion", with all the connotations of _LIBCPP_DEBUG_ASSERT rather than whatever is connoted by a plain _LIBCPP_ASSERT.

philnik updated this revision to Diff 398637.Jan 10 2022, 7:32 AM
philnik marked 3 inline comments as done.
  • Addressed comments
ldionne accepted this revision.Jan 10 2022, 7:41 AM
This revision is now accepted and ready to land.Jan 10 2022, 7:41 AM
This revision was automatically updated to reflect the committed changes.