[PATCH] D123100: [Support/Hash functions] Change the `final()` and `result()` of the hashing functions to return an array of bytes

Argyrios Kyrtzidis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 17:05:36 PDT 2022


akyrtzi created this revision.
Herald added subscribers: ayermolo, sdasgup3, wenzhicui, wrengr, Chia-hungDuan, dcaballe, cota, teijeong, dexonsmith, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, hiraditya, arichardson, emaste.
Herald added a reviewer: jhenderson.
Herald added a reviewer: rriddle.
Herald added a reviewer: MaskRay.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
akyrtzi requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, yota9, StephenFan, stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, MLIR, LLVM.

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 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 change the `BLAKE3` class API to match `HashBuilder`'s generic hash API.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123100

Files:
  bolt/lib/Core/DebugData.cpp
  clang/include/clang/Basic/Module.h
  clang/lib/Serialization/ASTWriter.cpp
  lld/ELF/Writer.cpp
  lld/MachO/SyntheticSections.cpp
  llvm/include/llvm/Support/BLAKE3.h
  llvm/include/llvm/Support/HashBuilder.h
  llvm/include/llvm/Support/MD5.h
  llvm/include/llvm/Support/SHA1.h
  llvm/include/llvm/Support/SHA256.h
  llvm/include/llvm/Support/raw_sha1_ostream.h
  llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/DebugInfo/CodeView/TypeHashing.cpp
  llvm/lib/ObjCopy/MachO/MachOWriter.cpp
  llvm/lib/Support/BLAKE3/README.md
  llvm/lib/Support/MD5.cpp
  llvm/lib/Support/SHA1.cpp
  llvm/lib/Support/SHA256.cpp
  llvm/unittests/Support/BLAKE3Test.cpp
  llvm/unittests/Support/HashBuilderTest.cpp
  llvm/unittests/Support/MD5Test.cpp
  llvm/unittests/Support/SHA256.cpp
  llvm/unittests/Support/raw_sha1_ostream_test.cpp
  mlir/lib/Pass/IRPrinting.cpp

STAMPS
actor(@akyrtzi) application(Differential) author(@akyrtzi) herald(H105) herald(H123) herald(H208) herald(H224) herald(H225) herald(H311) herald(H423) herald(H452) herald(H530) herald(H532) herald(H533) herald(H538) herald(H540) herald(H541) herald(H544) herald(H546) herald(H547) herald(H550) herald(H551) herald(H554) herald(H557) herald(H560) herald(H561) herald(H565) herald(H576) herald(H592) herald(H597) herald(H598) herald(H607) herald(H610) herald(H615) herald(H625) herald(H629) herald(H645) herald(H672) herald(H685) herald(H688) herald(H698) herald(H723) herald(H727) herald(H729) herald(H739) herald(H802) herald(H805) herald(H809) herald(H827) herald(H842) herald(H844) herald(H845) herald(H847) herald(H854) herald(H855) herald(H861) herald(H864) monogram(D123100) object-type(DREV) phid(PHID-DREV-ngvkfimyomxukhcmhald) reviewer(#lld-macho) reviewer(@Amir) reviewer(@jhenderson) reviewer(@maksfb) reviewer(@MaskRay) reviewer(@rafauler) reviewer(@rriddle) revision-repository(rG) revision-status(needs-review) subscriber(@aartbik) subscriber(@antiagainst) subscriber(@arichardson) subscriber(@arpith-jacob) subscriber(@ayermolo) subscriber(@cfe-commits) subscriber(@Chia-hungDuan) subscriber(@cota) subscriber(@dcaballe) subscriber(@dexonsmith) subscriber(@emaste) subscriber(@grosul1) subscriber(@hiraditya) subscriber(@Joonsoo) subscriber(@jurahul) subscriber(@Kayjukh) subscriber(@liufengdb) subscriber(@llvm-commits) subscriber(@mehdi_amini) subscriber(@mgester) subscriber(@msifontes) subscriber(@nicolasvasilache) subscriber(@rdzhabarov) subscriber(@rriddle) subscriber(@sdasgup3) subscriber(@shauheen) subscriber(@StephenFan) subscriber(@stephenneuendorffer) subscriber(@tatianashp) subscriber(@teijeong) subscriber(@wenzhicui) subscriber(@wrengr) subscriber(@yota9) tag(#all) tag(#clang) tag(#lld-macho) tag(#llvm) tag(#mlir) via(conduit)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123100.420348.patch
Type: text/x-patch
Size: 23632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220405/a7a9ea2a/attachment-0001.bin>


More information about the cfe-commits mailing list