diff options
author | Argyrios Kyrtzidis <kyrtzidis@apple.com> | 2022-04-04 16:48:30 -0700 |
---|---|---|
committer | Argyrios Kyrtzidis <kyrtzidis@apple.com> | 2022-04-05 21:38:06 -0700 |
commit | 330268ba346b679af786879d8f696c8c412a40eb (patch) | |
tree | 63cfc32052a65a937a326092c138d8b6086b355a /llvm/lib/MC/MCDwarf.cpp | |
parent | acfc785c0ef65d4177ed43ad4fb5c7c205904810 (diff) | |
download | llvm-330268ba346b679af786879d8f696c8c412a40eb.zip llvm-330268ba346b679af786879d8f696c8c412a40eb.tar.gz llvm-330268ba346b679af786879d8f696c8c412a40eb.tar.bz2 |
[Support/Hash functions] Change the `final()` and `result()` of the hashing functions to return an array of bytes
Returning `std::array<uint8_t, N>` is better ergonomics for the hashing functions usage, instead of a `StringRef`:
* When returning `StringRef`, client code is "jumping through hoops" to do string manipulations instead of dealing with fixed array of bytes directly, which is more natural
* Returning `std::array<uint8_t, N>` avoids the need for the hasher classes to keep a field just for the purpose of wrapping it and returning it as a `StringRef`
As part of this patch also:
* Introduce `TruncatedBLAKE3` which is useful for using BLAKE3 as the hasher type for `HashBuilder` with non-default hash sizes.
* Make `MD5Result` inherit from `std::array<uint8_t, 16>` which improves & simplifies its API.
Differential Revision: https://reviews.llvm.org/D123100
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 2cb5a00..f2e92fe 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -387,8 +387,7 @@ static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile, if (EmitMD5) { const MD5::MD5Result &Cksum = *DwarfFile.Checksum; MCOS->emitBinaryData( - StringRef(reinterpret_cast<const char *>(Cksum.Bytes.data()), - Cksum.Bytes.size())); + StringRef(reinterpret_cast<const char *>(Cksum.data()), Cksum.size())); } if (HasSource) { if (LineStr) |