diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-01 03:03:21 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-01 03:03:21 +0000 |
commit | 1fc660ff5141f1dcca786d8c31c4c16f6ebdea65 (patch) | |
tree | 71df869d728a5d6ce6f20e269841d8424c8f8c9a /tools/llvm-bcanalyzer | |
parent | 6584a7a479c2f385e7dc4601347ae10ae2547b46 (diff) |
Revert "Add support for computing SHA1 in LLVM"
This reverts commit r265096, r265095, and r265094.
Windows build is broken, and the validation does not pass.
From: Mehdi Amini <mehdi.amini@apple.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-bcanalyzer')
-rw-r--r-- | tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index 85dd5f52daac..6645045db8fa 100644 --- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -29,7 +29,6 @@ #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/ADT/Optional.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/Bitcode/LLVMBitCodes.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/Verifier.h" @@ -39,10 +38,8 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" -#include "llvm/Support/SHA1.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> -#include <array> #include <cctype> #include <map> #include <system_error> @@ -177,7 +174,6 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID, STRINGIFY_CODE(MODULE_CODE, VSTOFFSET) STRINGIFY_CODE(MODULE_CODE, METADATA_VALUES_UNUSED) STRINGIFY_CODE(MODULE_CODE, SOURCE_FILENAME) - STRINGIFY_CODE(MODULE_CODE, HASH) } case bitc::IDENTIFICATION_BLOCK_ID: switch (CodeID) { @@ -296,7 +292,6 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID, default: return nullptr; STRINGIFY_CODE(MST_CODE, ENTRY) - STRINGIFY_CODE(MST_CODE, HASH) } case bitc::GLOBALVAL_SUMMARY_BLOCK_ID: switch (CodeID) { @@ -486,9 +481,6 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID, if (Stream.EnterSubBlock(BlockID, &NumWords)) return Error("Malformed block record"); - // Keep it for later, when we see a MODULE_HASH record - uint64_t BlockEntryPos = Stream.getCurrentByteNo(); - const char *BlockName = nullptr; if (DumpRecords) { outs() << Indent << "<"; @@ -560,7 +552,6 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID, ++BlockStats.NumRecords; StringRef Blob; - unsigned CurrentRecordPos = Stream.getCurrentByteNo(); unsigned Code = Stream.readRecord(Entry.ID, Record, &Blob); // Increment the # occurrences of this code. @@ -595,37 +586,6 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID, for (unsigned i = 0, e = Record.size(); i != e; ++i) outs() << " op" << i << "=" << (int64_t)Record[i]; - // If we found a module hash, let's verify that it matches! - if (BlockID == bitc::MODULE_BLOCK_ID && Code == bitc::MODULE_CODE_HASH) { - if (Record.size() != 5) - outs() << " (invalid)"; - else { - // Recompute the hash and compare it to the one in the bitcode - SHA1 Hasher; - StringRef Hash; - { - int BlockSize = CurrentRecordPos - BlockEntryPos; - auto Ptr = Stream.getPointerToByte(BlockEntryPos, BlockSize); - Hasher.update(ArrayRef<uint8_t>(Ptr, BlockSize)); - Hash = Hasher.result(); - } - SmallString<20> RecordedHash; - RecordedHash.resize(20); - 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; - } - if (Hash == RecordedHash) - outs() << " (match)"; - else - outs() << " (!mismatch!)"; - } - } - outs() << "/>"; if (Abbv) { |