[PATCH] D37891: Driver: hoist the `wchar_t` handling to the driver

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 17:58:15 PDT 2017


compnerd added inline comments.


================
Comment at: lib/CodeGen/CodeGenModule.cpp:477
       Context.getTypeSizeInChars(Context.getWideCharType()).getQuantity();
-  assert((LangOpts.ShortWChar ||
-          llvm::TargetLibraryInfoImpl::getTargetWCharSize(Target.getTriple()) ==
----------------
MatzeB wrote:
> rnk wrote:
> > @MatzeB ptal
> Can you find a new place for this assert()? Please do not just remove it!
> 
> For the backstory: Unfortunately I had to duplicate the wchar decision logic inside llvm (TargetLibraryInfoImpl::getTargetWCharSize() for cases where we just have the target triple available but need to know the size of wchar_t using library function. This means the logic in LLVM needs to be updated when support for new platforms is added but for people adding platform support it will not be obvious that they have the change LLVM/TargetLibraryInfo as well unless an assert() point them to there being a mismatch.
Sure, I'll try to see if I can find a suitable place or adjustment of it.  However, one thing to note is that the frontend does actually embed that into the IR metadata ("wchar_size"). 


Repository:
  rL LLVM

https://reviews.llvm.org/D37891





More information about the cfe-commits mailing list