[libFuzzer] minor refactoring, NFC

llvm-svn: 313406
This commit is contained in:
Kostya Serebryany 2017-09-15 22:10:36 +00:00
parent eed0973270
commit bcd78491ef
3 changed files with 4 additions and 7 deletions

View File

@ -471,9 +471,8 @@ int AnalyzeDictionary(Fuzzer *F, const Vector<Unit>& Dict,
// Get coverage for the testcase without modifications.
F->ExecuteCallback(C.data(), C.size());
InitialFeatures.clear();
TPC.CollectFeatures([&](size_t Feature) -> bool {
TPC.CollectFeatures([&](size_t Feature) {
InitialFeatures.push_back(Feature);
return true;
});
for (size_t i = 0; i < Dict.size(); ++i) {
@ -498,9 +497,8 @@ int AnalyzeDictionary(Fuzzer *F, const Vector<Unit>& Dict,
// Get coverage for testcase with masked occurrences of dictionary unit.
F->ExecuteCallback(Data.data(), Data.size());
ModifiedFeatures.clear();
TPC.CollectFeatures([&](size_t Feature) -> bool {
TPC.CollectFeatures([&](size_t Feature) {
ModifiedFeatures.push_back(Feature);
return true;
});
if (InitialFeatures == ModifiedFeatures)

View File

@ -241,10 +241,9 @@ void Fuzzer::CrashResistantMergeInternalStep(const std::string &CFPath) {
// So it makes no sense to record all features for all files, instead we
// only record features that were not seen before.
Set<size_t> UniqFeatures;
TPC.CollectFeatures([&](size_t Feature) -> bool {
TPC.CollectFeatures([&](size_t Feature) {
if (AllFeatures.insert(Feature).second)
UniqFeatures.insert(Feature);
return true;
});
// Show stats.
if (!(TotalNumberOfRuns & (TotalNumberOfRuns - 1)))

View File

@ -208,7 +208,7 @@ unsigned CounterToFeature(T Counter) {
return Bit;
}
template <class Callback> // bool Callback(size_t Feature)
template <class Callback> // void Callback(size_t Feature)
ATTRIBUTE_NO_SANITIZE_ADDRESS
__attribute__((noinline))
void TracePC::CollectFeatures(Callback HandleFeature) const {