[PATCH] D88824: [Support][unittests] Enforce alignment in ConvertUTFTest

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 22:32:37 PDT 2020


efriedma added a comment.

Why are we trying to enforce alignment like this in the first place?  Writing an API that expects an overaligned ArrayRef<char> is just asking for trouble.  There should be two possibilities:

1. We have a native-endianness UTF-16 string.  The type of the input should be something like ArrayRef<uint16_t>, and that naturally has the right alignment.
2. We have some sequence of bytes which are supposed to be either UTF-16LE or UTF-16BE, independent of the host.  In this case, we shouldn't be making random alignment assumptions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88824/new/

https://reviews.llvm.org/D88824



More information about the llvm-commits mailing list