summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerCorpus.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-03-31 04:17:45 +0000
committerKostya Serebryany <kcc@google.com>2017-03-31 04:17:45 +0000
commita617e16ff128c8aeac28212b5f06df212f6bbf3e (patch)
tree938c9d4f1b33cc7f962b8f946410919ffb6680dc /llvm/lib/Fuzzer/FuzzerCorpus.h
parent7de1f1a826a9f1848e09f7c312fb47f00f8d589e (diff)
downloadbcm5719-llvm-a617e16ff128c8aeac28212b5f06df212f6bbf3e.tar.gz
bcm5719-llvm-a617e16ff128c8aeac28212b5f06df212f6bbf3e.zip
[libFuzzer] simplify the code a bit
llvm-svn: 299180
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerCorpus.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerCorpus.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerCorpus.h b/llvm/lib/Fuzzer/FuzzerCorpus.h
index b6cbf3638c6..0f0573994a0 100644
--- a/llvm/lib/Fuzzer/FuzzerCorpus.h
+++ b/llvm/lib/Fuzzer/FuzzerCorpus.h
@@ -133,7 +133,7 @@ class InputCorpus {
Printf("EVICTED %zd\n", Idx);
}
- bool AddFeature(size_t Idx, uint32_t NewSize, bool Shrink) {
+ void AddFeature(size_t Idx, uint32_t NewSize, bool Shrink) {
assert(NewSize);
Idx = Idx % kFeatureSetSize;
uint32_t OldSize = GetFeature(Idx);
@@ -148,17 +148,17 @@ class InputCorpus {
} else {
NumAddedFeatures++;
}
+ NumUpdatedFeatures++;
if (FeatureDebug)
Printf("ADD FEATURE %zd sz %d\n", Idx, NewSize);
SmallestElementPerFeature[Idx] = Inputs.size();
InputSizesPerFeature[Idx] = NewSize;
CountingFeatures = true;
- return true;
}
- return false;
}
size_t NumFeatures() const { return NumAddedFeatures; }
+ size_t NumFeatureUpdates() const { return NumUpdatedFeatures; }
void ResetFeatureSet() {
assert(Inputs.empty());
@@ -212,6 +212,7 @@ private:
bool CountingFeatures = false;
size_t NumAddedFeatures = 0;
+ size_t NumUpdatedFeatures = 0;
uint32_t InputSizesPerFeature[kFeatureSetSize];
uint32_t SmallestElementPerFeature[kFeatureSetSize];
OpenPOWER on IntegriCloud