This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Use builtins when redeclaring <string.h> functions
ClosedPublic

Authored by ldionne on Nov 24 2022, 12:01 PM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rGf62d4135c5cd: [libc++] Use builtins when redeclaring <string.h> functions
Summary

When we define the const-correct overloads of <string.h> functions in
libc++ itself, use builtins whenever possible. This avoids depending on
the presence of these functions in the C library headers.

Also, as a fly-by, improve the tests for these functions since we
basically didn't check anything but their signature. We could have
used the wrong builtin (as long as the signature matched) without ever
noticing, which was quite scary.

Diff Detail

Event Timeline

ldionne created this revision.Nov 24 2022, 12:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2022, 12:01 PM
ldionne requested review of this revision.Nov 24 2022, 12:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2022, 12:01 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Nov 25 2022, 6:21 AM

Shipping since CI passed and this will mostly impact Darwin anyway, since the other platforms we support already provide the const-correct overloads.

This revision is now accepted and ready to land.Nov 25 2022, 6:21 AM
This revision was landed with ongoing or failed builds.Nov 25 2022, 6:22 AM
This revision was automatically updated to reflect the committed changes.