[llvm] a4961f0 - Revert "[Support][unittests] Enforce alignment in ConvertUTFTest"

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 19:23:44 PDT 2020


Author: Nico Weber
Date: 2020-10-07T22:23:08-04:00
New Revision: a4961f0d8a2ec91e209b9d3ea7b03acac4f5a8b1

URL: https://github.com/llvm/llvm-project/commit/a4961f0d8a2ec91e209b9d3ea7b03acac4f5a8b1
DIFF: https://github.com/llvm/llvm-project/commit/a4961f0d8a2ec91e209b9d3ea7b03acac4f5a8b1.diff

LOG: Revert "[Support][unittests] Enforce alignment in ConvertUTFTest"

This reverts commit 53b3873cf428fd78f1d92504cc20adf11181ead7.
Seems to break SupportTests.exe's
ConvertUTFTest.UTF16WrappersForConvertUTF16ToUTF8String
on Windows.

Added: 
    

Modified: 
    llvm/lib/Support/ConvertUTFWrapper.cpp
    llvm/unittests/Support/ConvertUTFTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/ConvertUTFWrapper.cpp b/llvm/lib/Support/ConvertUTFWrapper.cpp
index d8d46712a593..6ec567882ea6 100644
--- a/llvm/lib/Support/ConvertUTFWrapper.cpp
+++ b/llvm/lib/Support/ConvertUTFWrapper.cpp
@@ -97,8 +97,6 @@ bool convertUTF16ToUTF8String(ArrayRef<char> SrcBytes, std::string &Out) {
   const UTF16 *Src = reinterpret_cast<const UTF16 *>(SrcBytes.begin());
   const UTF16 *SrcEnd = reinterpret_cast<const UTF16 *>(SrcBytes.end());
 
-  assert((uintptr_t)Src % sizeof(UTF16) == 0);
-
   // Byteswap if necessary.
   std::vector<UTF16> ByteSwapped;
   if (Src[0] == UNI_UTF16_BYTE_ORDER_MARK_SWAPPED) {

diff  --git a/llvm/unittests/Support/ConvertUTFTest.cpp b/llvm/unittests/Support/ConvertUTFTest.cpp
index b689e688f720..83019722332d 100644
--- a/llvm/unittests/Support/ConvertUTFTest.cpp
+++ b/llvm/unittests/Support/ConvertUTFTest.cpp
@@ -16,7 +16,7 @@ using namespace llvm;
 
 TEST(ConvertUTFTest, ConvertUTF16LittleEndianToUTF8String) {
   // Src is the look of disapproval.
-  alignas(UTF16) static const char Src[] = "\xff\xfe\xa0\x0c_\x00\xa0\x0c";
+  static const char Src[] = "\xff\xfe\xa0\x0c_\x00\xa0\x0c";
   ArrayRef<char> Ref(Src, sizeof(Src) - 1);
   std::string Result;
   bool Success = convertUTF16ToUTF8String(Ref, Result);
@@ -27,7 +27,7 @@ TEST(ConvertUTFTest, ConvertUTF16LittleEndianToUTF8String) {
 
 TEST(ConvertUTFTest, ConvertUTF16BigEndianToUTF8String) {
   // Src is the look of disapproval.
-  alignas(UTF16) static const char Src[] = "\xfe\xff\x0c\xa0\x00_\x0c\xa0";
+  static const char Src[] = "\xfe\xff\x0c\xa0\x00_\x0c\xa0";
   ArrayRef<char> Ref(Src, sizeof(Src) - 1);
   std::string Result;
   bool Success = convertUTF16ToUTF8String(Ref, Result);


        


More information about the llvm-commits mailing list