diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp index e70caa83c8c1..2ce064c7685a 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp @@ -130,7 +130,7 @@ static Optional<const char *> GetCodeName(unsigned CodeID, unsigned BlockID, STRINGIFY_CODE(MODULE_CODE, DATALAYOUT) STRINGIFY_CODE(MODULE_CODE, ASM) STRINGIFY_CODE(MODULE_CODE, SECTIONNAME) - STRINGIFY_CODE(MODULE_CODE, DEPLIB) // FIXME: Remove in 4.0 + STRINGIFY_CODE(MODULE_CODE, DEPLIB) // Deprecated, present in old bitcode STRINGIFY_CODE(MODULE_CODE, GLOBALVAR) STRINGIFY_CODE(MODULE_CODE, FUNCTION) STRINGIFY_CODE(MODULE_CODE, ALIAS) @@ -305,6 +305,8 @@ static Optional<const char *> GetCodeName(unsigned CodeID, unsigned BlockID, STRINGIFY_CODE(FS, CFI_FUNCTION_DECLS) STRINGIFY_CODE(FS, TYPE_ID) STRINGIFY_CODE(FS, TYPE_ID_METADATA) + STRINGIFY_CODE(FS, BLOCK_COUNT) + STRINGIFY_CODE(FS, PARAM_ACCESS) } case bitc::METADATA_ATTACHMENT_ID: switch (CodeID) { @@ -910,17 +912,14 @@ Error BitcodeAnalyzer::parseBlock(unsigned BlockID, unsigned IndentLevel, Hasher.update(ArrayRef<uint8_t>(Ptr, BlockSize)); Hash = Hasher.result(); } - SmallString<20> RecordedHash; - RecordedHash.resize(20); + std::array<char, 20> RecordedHash; int Pos = 0; for (auto &Val : Record) { assert(!(Val >> 32) && "Unexpected high bits set"); - RecordedHash[Pos++] = (Val >> 24) & 0xFF; - RecordedHash[Pos++] = (Val >> 16) & 0xFF; - RecordedHash[Pos++] = (Val >> 8) & 0xFF; - RecordedHash[Pos++] = (Val >> 0) & 0xFF; + support::endian::write32be(&RecordedHash[Pos], Val); + Pos += 4; } - if (Hash == RecordedHash) + if (Hash == StringRef(RecordedHash.data(), RecordedHash.size())) O->OS << " (match)"; else O->OS << " (!mismatch!)"; |