[libFuzzer] refactoring the code that checks the coverage. NFC
[oota-llvm.git] / lib / Fuzzer / FuzzerInternal.h
index a57cd113553778a9ee8d96b9e070f6a38fa2c044..85f86158373f7fae02bd4dc205a0616add9f2c10 100644 (file)
@@ -123,11 +123,9 @@ class Fuzzer {
  private:
   void AlarmCallback();
   void MutateAndTestOne(Unit *U);
-  void ReportNewCoverage(size_t NewCoverage, const Unit &U);
-  size_t RunOne(const Unit &U);
+  void ReportNewCoverage(const Unit &U);
+  bool RunOne(const Unit &U);
   void RunOneAndUpdateCorpus(Unit &U);
-  size_t RunOneMaximizeTotalCoverage(const Unit &U);
-  size_t RunOneMaximizeCoveragePairs(const Unit &U);
   void WriteToOutputCorpus(const Unit &U);
   void WriteUnitToFileWithPrefix(const Unit &U, const char *Prefix);
   void PrintStats(const char *Where, size_t Cov, const char *End = "\n");
@@ -135,6 +133,11 @@ class Fuzzer {
 
   void SyncCorpus();
 
+  size_t RecordBlockCoverage();
+  void PrepareCoverageBeforeRun();
+  bool CheckCoverageAfterRun();
+
+
   // Trace-based fuzzing: we run a unit with some kind of tracing
   // enabled and record potentially useful mutations. Then
   // We apply these mutations one by one to the unit and run it again.
@@ -172,6 +175,7 @@ class Fuzzer {
   system_clock::time_point UnitStartTime;
   long TimeOfLongestUnitInSeconds = 0;
   long EpochOfLastReadOfOutputCorpus = 0;
+  size_t LastRecordedBlockCoverage = 0;
 };
 
 class SimpleUserSuppliedFuzzer: public UserSuppliedFuzzer {