sepavloff added inline comments.
================ Comment at: clang/unittests/Driver/ToolChainTest.cpp:604-606 + char *StrBuff = (char *)Alloc.Allocate(6, 2); + std::memcpy(StrBuff, "\xFF\xFE\x00\xD8\x00\x00", 6); + StringRef BadUTF(StrBuff, 6); ---------------- mgorny wrote: > Wouldn't it be possible to use `std::string`, or maybe even `std::array<char, > ...>` here? I think it'd be less error-prone. Nor `std::string` neither `std::array<char,N>` provide custom alignment. UTF-16 string is constructed here from array of chars to avoid problems with endianness. It consists of 2-byte elements and is expected to be aligned on 2-byte boundary. Array of chars is aligned on byte and sometimes the test failed due to invalid alignment. So we have to use bare pointer to have guaranteed alignment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136090/new/ https://reviews.llvm.org/D136090 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits