Page MenuHomePhabricator

TargetLibraryInfo: Stop guessing the wchar_t size

Authored by MatzeB on Sep 20 2017, 3:55 PM.



Usually the frontend communicates the size of wchar_t via metadata and
we can optimize wcslen (and possibly other calls in the future). In
cases without the wchar_size metadata we would previously try to guess
the correct size based on the target triple; however this is fragile to
keep up to date and may miss users manually changing the size via flags.
Better be safe and stop guessing and optimizing if the frontend didn't
communicate the size.

Diff Detail


Event Timeline

MatzeB created this revision.Sep 20 2017, 3:55 PM

After thinking about it some more, I decided that we better leave the logic to decide on the wchar_t size to a C frontend.

Related/motivated by the discussion in

MatzeB updated this revision to Diff 116105.Sep 20 2017, 3:59 PM

Add a unittest to ensure we are indeed not guessing the wchar_t size.

compnerd accepted this revision.Sep 20 2017, 4:16 PM

This is pretty awesome. I assume that you will do a corresponding change in clang to remove the single use of that function?

This revision is now accepted and ready to land.Sep 20 2017, 4:16 PM
MatzeB closed this revision.Sep 26 2017, 12:00 PM

Thanks, committed in r314185