Unify the two CRC implementations
authorHans Wennborg <hans@hanshq.net>
Wed, 9 Oct 2019 09:06:30 +0000 (09:06 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 9 Oct 2019 09:06:30 +0000 (09:06 +0000)
commit1e1e3ba2526ecab1ad3c18c97abef36df00b3813
tree58e8e645b1d85f51ab432d8ab7e279df0b3caf17
parentf8d482c07be46b2ed0c280dfda1bb86cab5de386
Unify the two CRC implementations

David added the JamCRC implementation in r246590. More recently, Eugene
added a CRC-32 implementation in r357901, which falls back to zlib's
crc32 function if present.

These checksums are essentially the same, so having multiple
implementations seems unnecessary. This replaces the CRC-32
implementation with the simpler one from JamCRC, and implements the
JamCRC interface in terms of CRC-32 since this means it can use zlib's
implementation when available, saving a few bytes and potentially making
it faster.

JamCRC took an ArrayRef<char> argument, and CRC-32 took a StringRef.
This patch changes it to ArrayRef<uint8_t> which I think is the best
choice, and simplifies a few of the callers nicely.

Differential revision: https://reviews.llvm.org/D68570

llvm-svn: 374148
18 files changed:
clang/lib/AST/MicrosoftMangle.cpp
lld/COFF/PDB.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
llvm/include/llvm/Support/CRC.h
llvm/include/llvm/Support/JamCRC.h [deleted file]
llvm/lib/DebugInfo/PDB/Native/Hash.cpp
llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
llvm/lib/MC/WinCOFFObjectWriter.cpp
llvm/lib/Support/CMakeLists.txt
llvm/lib/Support/CRC.cpp
llvm/lib/Support/JamCRC.cpp [deleted file]
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
llvm/tools/llvm-objcopy/CopyConfig.cpp
llvm/unittests/Support/CRCTest.cpp
llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn