This is an archive of the discontinued LLVM Phabricator instance.

[libc] add basic wide char functions
ClosedPublic

Authored by michaelrj on Mar 13 2023, 3:33 PM.

Details

Summary

This patch adds the wchar header, as well as the functions to convert to
and from wide chars. The header also sets up the definitions for wint
and wchar.

Diff Detail

Event Timeline

michaelrj created this revision.Mar 13 2023, 3:33 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 13 2023, 3:33 PM
michaelrj requested review of this revision.Mar 13 2023, 3:33 PM
lntue accepted this revision.Mar 16 2023, 6:03 PM
lntue added inline comments.
libc/include/llvm-libc-macros/wchar-macros.h
1

wchar.h ?

libc/src/__support/wctype_utils.h
13

nit: space after //

This revision is now accepted and ready to land.Mar 16 2023, 6:03 PM

Except of the definition of the new types, the rest LGTM. We should of course formally define our position on the locales that we care about.

libc/include/wchar.h.def
15

Each of these types should have their own type header (we already have one for size_t). They will get into the final header file if you add them to api.td.

michaelrj updated this revision to Diff 506771.Mar 20 2023, 4:35 PM
michaelrj marked 3 inline comments as done.

clean up type definitions to use the API system.

I agree and will try to make a document describing our plan for locale support as a followup patch.

This revision was landed with ongoing or failed builds.Mar 20 2023, 4:36 PM
This revision was automatically updated to reflect the committed changes.