This is an archive of the discontinued LLVM Phabricator instance.

[libc++] [LIBCXX-DEBUG-FIXME] Fix an iterator-invalidation issue in string::assign.
ClosedPublic

Authored by Quuxplusone on Apr 30 2021, 4:53 PM.

Details

Summary
This appears to be a bug in our string::assign: when assigning into
a longer string, from a shorter snippet of itself, we invalidate
iterators before doing the copy. We should invalidate them afterward.
Also drive-by improve the formatting of a function header.

Diff Detail

Event Timeline

Quuxplusone requested review of this revision.Apr 30 2021, 4:53 PM
Quuxplusone created this revision.
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald TranscriptApr 30 2021, 4:53 PM

SGTM except for a minor question. Do you know why the debug iterator CI job fails?

libcxx/include/string
1787

I like this change!

2362

Is this change really required? We don't use our own iterators in this case.
I'm not objecting against this change.

Quuxplusone added inline comments.May 2 2021, 6:51 AM
libcxx/include/string
2362

I believe this change is not required; but yeah, it seemed like a good idea for consistency.
The CI job was failing because D101003 hadn't landed in main yet when it kicked off; I'll rebase to prove it's OK.

poke buildkite

Mordante accepted this revision as: Mordante.May 2 2021, 10:04 AM

Thanks for rebasing, LGTM.

ldionne accepted this revision.May 5 2021, 10:55 AM
This revision is now accepted and ready to land.May 5 2021, 10:55 AM