diff options
author | Zachary Turner <zturner@google.com> | 2018-05-17 22:55:15 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-05-17 22:55:15 +0000 |
commit | c762666e8747841ab7dd785415e1354a1682e954 (patch) | |
tree | 3b5c27f57f9fc47358687413fab9e6fdad36ecad /llvm/lib/ObjectYAML | |
parent | 070777dbdd3995137316252005020d68e0e1dcd9 (diff) | |
download | bcm5719-llvm-c762666e8747841ab7dd785415e1354a1682e954.tar.gz bcm5719-llvm-c762666e8747841ab7dd785415e1354a1682e954.zip |
Resubmit [pdb] Change /DEBUG:GHASH to emit 8 byte hashes."
This fixes the remaining failing tests, so resubmitting with no
functional change.
llvm-svn: 332676
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r-- | llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp index bbbd7c06772..ed117059560 100644 --- a/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp +++ b/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp @@ -13,6 +13,8 @@ //===----------------------------------------------------------------------===// #include "llvm/ObjectYAML/CodeViewYAMLTypeHashing.h" + +#include "llvm/BinaryFormat/COFF.h" #include "llvm/Support/BinaryByteStream.h" #include "llvm/Support/BinaryStreamReader.h" #include "llvm/Support/BinaryStreamWriter.h" @@ -46,16 +48,17 @@ StringRef ScalarTraits<GlobalHash>::input(StringRef Scalar, void *Ctx, DebugHSection llvm::CodeViewYAML::fromDebugH(ArrayRef<uint8_t> DebugH) { assert(DebugH.size() >= 8); - assert((DebugH.size() - 8) % 20 == 0); + assert((DebugH.size() - 8) % 8 == 0); BinaryStreamReader Reader(DebugH, llvm::support::little); DebugHSection DHS; cantFail(Reader.readInteger(DHS.Magic)); cantFail(Reader.readInteger(DHS.Version)); cantFail(Reader.readInteger(DHS.HashAlgorithm)); + while (Reader.bytesRemaining() != 0) { ArrayRef<uint8_t> S; - cantFail(Reader.readBytes(S, 20)); + cantFail(Reader.readBytes(S, 8)); DHS.Hashes.emplace_back(S); } assert(Reader.bytesRemaining() == 0); @@ -64,19 +67,20 @@ DebugHSection llvm::CodeViewYAML::fromDebugH(ArrayRef<uint8_t> DebugH) { ArrayRef<uint8_t> llvm::CodeViewYAML::toDebugH(const DebugHSection &DebugH, BumpPtrAllocator &Alloc) { - uint32_t Size = 8 + 20 * DebugH.Hashes.size(); + uint32_t Size = 8 + 8 * DebugH.Hashes.size(); uint8_t *Data = Alloc.Allocate<uint8_t>(Size); MutableArrayRef<uint8_t> Buffer(Data, Size); BinaryStreamWriter Writer(Buffer, llvm::support::little); + cantFail(Writer.writeInteger(DebugH.Magic)); cantFail(Writer.writeInteger(DebugH.Version)); cantFail(Writer.writeInteger(DebugH.HashAlgorithm)); - SmallString<20> Hash; + SmallString<8> Hash; for (const auto &H : DebugH.Hashes) { Hash.clear(); raw_svector_ostream OS(Hash); H.Hash.writeAsBinary(OS); - assert((Hash.size() == 20) && "Invalid hash size!"); + assert((Hash.size() == 8) && "Invalid hash size!"); cantFail(Writer.writeFixedString(Hash)); } assert(Writer.bytesRemaining() == 0); |