mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 23:51:56 +00:00
[libFuzzer] minor refactoring, NFC
llvm-svn: 313406
This commit is contained in:
parent
eed0973270
commit
bcd78491ef
@ -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)
|
||||
|
@ -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)))
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user