[Basic] Always serialize integers in little-endian byte order

This change fixes the ExponentialGrowthAppendingBinaryByteStream
tests on big endian machines.

Force ExponentialGrowthAppendingBinaryByteStreams to use little-
endian byte order. We always used little-endian byte order anyway
and it seems very unlikely we'll need the flexibility to make the
stream big-endian in the future. The benefit of this is that we
can use portable APIs while still allowing the compiler to remove
conditional byte swaps.

Also replace writeRaw with writeInteger and make it explicitly
little-endian to make the API cleaner and more portable.
This commit is contained in:
Michael Munday
2018-12-05 16:13:49 -05:00
parent af0291b072
commit ce3aff12da
5 changed files with 30 additions and 43 deletions

View File

@@ -735,8 +735,7 @@ int doSerializeRawTree(const char *MainExecutablePath,
return EXIT_FAILURE;
}
swift::ExponentialGrowthAppendingBinaryByteStream Stream(
llvm::support::endianness::little);
auto Stream = ExponentialGrowthAppendingBinaryByteStream();
Stream.reserve(32 * 1024);
std::map<void *, void *> UserInfo;
UserInfo[swift::byteTree::UserInfoKeyReusedNodeIds] = &ReusedNodeIds;