diff options
author | Kostya Serebryany <kcc@google.com> | 2017-12-08 22:21:42 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2017-12-08 22:21:42 +0000 |
commit | 741ec2c3c00cd768151fc4cfc37d4e4d43c9f58b (patch) | |
tree | d65178a2c617e9f00694244196b3a2468cc29fb6 /lib/fuzzer/FuzzerTracePC.h | |
parent | e192b547369508e2fedc3eab8ac473d3ee158443 (diff) |
[libFuzzer] honor -use_counters, sligntly change the meaning of -experimental_len_control, call UpdateFeatureFrequency only if instructed by the flag
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerTracePC.h')
-rw-r--r-- | lib/fuzzer/FuzzerTracePC.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/fuzzer/FuzzerTracePC.h b/lib/fuzzer/FuzzerTracePC.h index 9df3d817d..f3bb41e42 100644 --- a/lib/fuzzer/FuzzerTracePC.h +++ b/lib/fuzzer/FuzzerTracePC.h @@ -230,7 +230,10 @@ void TracePC::CollectFeatures(Callback HandleFeature) const { size_t N = GetNumPCs(); auto Handle8bitCounter = [&](size_t FirstFeature, size_t Idx, uint8_t Counter) { - HandleFeature(FirstFeature + Idx * 8 + CounterToFeature(Counter)); + if (UseCounters) + HandleFeature(FirstFeature + Idx * 8 + CounterToFeature(Counter)); + else + HandleFeature(FirstFeature + Idx); }; size_t FirstFeature = 0; @@ -251,8 +254,12 @@ void TracePC::CollectFeatures(Callback HandleFeature) const { if (size_t NumClangCounters = ClangCountersEnd() - ClangCountersBegin()) { auto P = ClangCountersBegin(); for (size_t Idx = 0; Idx < NumClangCounters; Idx++) - if (auto Cnt = P[Idx]) - HandleFeature(FirstFeature + Idx * 8 + CounterToFeature(Cnt)); + if (auto Cnt = P[Idx]) { + if (UseCounters) + HandleFeature(FirstFeature + Idx * 8 + CounterToFeature(Cnt)); + else + HandleFeature(FirstFeature + Idx); + } FirstFeature += NumClangCounters; } |