llvm::TargetLibraryInfo needs to know the size of wchar_t to work on
functions like wcslen. This patch changes clang to always emit the
wchar_size module flag (it would only do so for ARM previously).
This also adds an assert() to ensure the LLVM defaults based on the
target triple are in sync with clang.
Details
Details
- Reviewers
dblaikie rnk efriedma olista01 - Commits
- rGa4519532246a: CodeGenModule: Always output wchar_size, check LLVM assumptions.
rGbf4a869dfb35: CodeGenModule: Always output wchar_size, check LLVM assumptions.
rC303478: CodeGenModule: Always output wchar_size, check LLVM assumptions.
rC303463: CodeGenModule: Always output wchar_size, check LLVM assumptions.
rL303478: CodeGenModule: Always output wchar_size, check LLVM assumptions.
rL303463: CodeGenModule: Always output wchar_size, check LLVM assumptions.
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
This makes sense to me, but I'll wait to see if anyone else has a comment.
test/CodeGen/wchar-size.c | ||
---|---|---|
2 ↗ | (On Diff #98225) | Maybe add a comment to the test noting that -fno-short-wchar has no effect on Windows. |
Comment Actions
As far as I can tell DataLayout is designed to talk about llvm types (llvm::Type), talking about types/typedefs at the source language level seems out of scope.
Comment Actions
ping. Do we really need wchar_t size in DataLayout to move this forward? I'm not convinced that is the right place for it...
Comment Actions
I guess this is better than DataLayout. Also, the user experience of mixing two TUs with different -fshort-wchar settings during LTO is better.
lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
473 ↗ | (On Diff #99344) | Is this what clang-format does? |