[PATCH] D74359: [compiler-rt] FuzzedDataProvider: add ConsumeData method.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 13:46:10 PST 2020


Dor1s marked 5 inline comments as done.
Dor1s added a comment.

I'm gonna rebase and commit, since there isn't much to review compared to the PS#1 (just a test).



================
Comment at: compiler-rt/include/fuzzer/FuzzedDataProvider.h:252
+
+  // Returns the hash of the remaining data. Not recommended in general, but is
+  // useful when you need a pseudo-random value that changes significantly with
----------------
metzman wrote:
> I think saying "Not recommended in general" is a bit weird. What's wrong with it for the intended purpose?
> maybe say it's the `std::hash`. When I read "the hash" my first thought was "which? md5? sha1? etc."
yeah, this is one more argument not to add such method, deleted


================
Comment at: compiler-rt/include/fuzzer/FuzzedDataProvider.h:255
+  // any change in the fuzzing data.
+  size_t hash() {
+    // TODO(Dor1s): change to `string_view` once C++17 becomes mainstream.
----------------
metzman wrote:
> I think we need to include `<functional>` to use `std::hash` right?
good catch, I've also forgot `<>` for the template parameter, but anyway it's deleted now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74359/new/

https://reviews.llvm.org/D74359





More information about the llvm-commits mailing list