[PATCH] D50194: LLVM Proto Fuzzer - Run Functions on Suite of Inputs

Matt Morehouse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 3 14:41:13 PDT 2018


morehouse added inline comments.


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:75
 
+// Helper function to print error message and stop the fuzzer
 void ErrorAndExit(std::string message) {
----------------
Unnecessary comment.   The naming and implementation of this function are intuitive.


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:170
 
-  typedef void (*func)(int*, int*, int*, int);
-  func f = reinterpret_cast<func>(EE->getPointerToFunction(EntryFunc)); 
+  LLVMFunc f = (LLVMFunc) EE->getPointerToFunction(EntryFunc); 
 
----------------
Does `reinterpret_cast` work here?


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:184
+  // Populate OptArrays and UnoptArrays with the arrays from InputArrays
+  memcpy(OptArrays, InputArrays, sizeof(int) * ArraySize * NumArrays);
+  memcpy(UnoptArrays, InputArrays, sizeof(int) * ArraySize * NumArrays);
----------------
The size here is reused a few times.  Let's create a variable for it.


Repository:
  rC Clang

https://reviews.llvm.org/D50194





More information about the cfe-commits mailing list