Skip to content

Commit

Permalink
[libFuzzer] don't clear Counters in TracePC::CollectFeatures since th…
Browse files Browse the repository at this point in the history
…ey will be cleared anyway in ResetMaps

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297783 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
kcc committed Mar 14, 2017
1 parent 9db5e41 commit 05628fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/Fuzzer/FuzzerTracePC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class Callback> size_t CollectFeatures(Callback CB);
template <class Callback> size_t CollectFeatures(Callback CB) const;

void ResetMaps() {
ValueProfileMap.Reset();
Expand Down Expand Up @@ -111,7 +111,7 @@ class TracePC {
};

template <class Callback>
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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/Fuzzer/FuzzerValueBitMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct ValueBitMap {

template <class Callback>
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++)
Expand Down

0 comments on commit 05628fa

Please sign in to comment.