summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerInternal.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-02-19 18:45:37 +0000
committerKostya Serebryany <kcc@google.com>2015-02-19 18:45:37 +0000
commit016852c3963b43c22bc385859178cf132eee22f1 (patch)
tree8643b5f6e8b395bbf295a836c977b03d44518791 /llvm/lib/Fuzzer/FuzzerInternal.h
parent0897091730aa361d13a34495a0e81613e43c0bb6 (diff)
downloadbcm5719-llvm-016852c3963b43c22bc385859178cf132eee22f1.tar.gz
bcm5719-llvm-016852c3963b43c22bc385859178cf132eee22f1.zip
[fuzzer] split main() into FuzzerDriver() that takes a callback as a parameter and a tiny main() in a separate file
llvm-svn: 229882
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInternal.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerInternal.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h
index 34752ff4944..bc18c551f59 100644
--- a/llvm/lib/Fuzzer/FuzzerInternal.h
+++ b/llvm/lib/Fuzzer/FuzzerInternal.h
@@ -17,6 +17,8 @@
#include <vector>
#include <unordered_set>
+#include "FuzzerInterface.h"
+
namespace fuzzer {
typedef std::vector<uint8_t> Unit;
using namespace std::chrono;
@@ -51,7 +53,8 @@ class Fuzzer {
size_t MaxNumberOfRuns = ULONG_MAX;
std::string OutputCorpus;
};
- Fuzzer(FuzzingOptions Options) : Options(Options) {
+ Fuzzer(UserCallback Callback, FuzzingOptions Options)
+ : Callback(Callback), Options(Options) {
SetDeathCallback();
}
void AddToCorpus(const Unit &U) { Corpus.push_back(U); }
@@ -89,6 +92,7 @@ class Fuzzer {
std::vector<Unit> Corpus;
std::unordered_set<uintptr_t> FullCoverageSets;
+ UserCallback Callback;
FuzzingOptions Options;
system_clock::time_point ProcessStartTime = system_clock::now();
static system_clock::time_point UnitStartTime;
OpenPOWER on IntegriCloud