From: Kostya Serebryany Date: Tue, 14 Mar 2017 21:40:53 +0000 (+0000) Subject: [libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be clear... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=05628fa8ffabe0dc82624d50dc62d48c614491e5;p=llvm [libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be cleared anyway in ResetMaps git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297783 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Fuzzer/FuzzerTracePC.h b/lib/Fuzzer/FuzzerTracePC.h index b33d38747a3..05d03e960c9 100644 --- a/lib/Fuzzer/FuzzerTracePC.h +++ b/lib/Fuzzer/FuzzerTracePC.h @@ -57,7 +57,7 @@ class TracePC { void SetUseCounters(bool UC) { UseCounters = UC; } void SetUseValueProfile(bool VP) { UseValueProfile = VP; } void SetPrintNewPCs(bool P) { DoPrintNewPCs = P; } - template size_t CollectFeatures(Callback CB); + template size_t CollectFeatures(Callback CB) const; void ResetMaps() { ValueProfileMap.Reset(); @@ -111,7 +111,7 @@ private: }; template -size_t TracePC::CollectFeatures(Callback CB) { +size_t TracePC::CollectFeatures(Callback CB) const { if (!UsingTracePcGuard()) return 0; size_t Res = 0; const size_t Step = 8; @@ -125,7 +125,6 @@ size_t TracePC::CollectFeatures(Callback CB) { for (size_t i = Idx; i < Idx + Step; i++) { uint8_t Counter = (Bundle >> ((i - Idx) * 8)) & 0xff; if (!Counter) continue; - Counters[i] = 0; unsigned Bit = 0; /**/ if (Counter >= 128) Bit = 7; else if (Counter >= 32) Bit = 6; diff --git a/lib/Fuzzer/FuzzerValueBitMap.h b/lib/Fuzzer/FuzzerValueBitMap.h index 600337ae407..8f7ff74300f 100644 --- a/lib/Fuzzer/FuzzerValueBitMap.h +++ b/lib/Fuzzer/FuzzerValueBitMap.h @@ -76,7 +76,7 @@ struct ValueBitMap { template ATTRIBUTE_NO_SANITIZE_ALL - void ForEach(Callback CB) { + void ForEach(Callback CB) const { for (size_t i = 0; i < kMapSizeInWords; i++) if (uintptr_t M = Map[i]) for (size_t j = 0; j < sizeof(M) * 8; j++)