This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Include C++ headers, not C headers, in <charconv>
ClosedPublic

Authored by Quuxplusone on Dec 8 2020, 11:48 AM.

Details

Summary

This matches how libc++ does it in all other C++ headers (that is, headers not ending in ".h").
We need to include <cstring> if we want to use _VSTD::memmove instead of unqualified ADL memmove. Even though ADL doesn't physically matter in <charconv>'s specific case, I'm trying to migrate libc++ to using _VSTD::memmove for all cases (because some of them do matter, and this way it's easier to grep for outliers).

Diff Detail

Event Timeline

Quuxplusone requested review of this revision.Dec 8 2020, 11:48 AM
Quuxplusone created this revision.
Herald added a reviewer: Restricted Project. · View Herald TranscriptDec 8 2020, 11:48 AM
lichray accepted this revision.Dec 8 2020, 11:59 AM
libcxx/include/charconv
429

For the record: It might be nice if all of these function calls were also _VSTD-ed, but I decided that I didn't want to be that invasive right now. I am 99% confident that none of these function calls (including the memmove/memcpy ones that I am changing) can possibly be hijacked by ADL, because to_chars and from_chars are not templates and therefore no user-defined or even non-primitive types can possibly leak into these codepaths which are reachable only via the "bottleneck" of those non-template functions.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 10 2020, 7:03 PM
This revision was automatically updated to reflect the committed changes.