| 1 |
// Copyright (c) 2020 Google LLC |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
#ifndef SOURCE_FUZZ_REPEATED_PASS_RECOMMENDER_STANDARD_H_ |
| 16 |
#define SOURCE_FUZZ_REPEATED_PASS_RECOMMENDER_STANDARD_H_ |
| 17 |
|
| 18 |
#include "source/fuzz/fuzzer_context.h" |
| 19 |
#include "source/fuzz/pass_management/repeated_pass_instances.h" |
| 20 |
#include "source/fuzz/pass_management/repeated_pass_recommender.h" |
| 21 |
|
| 22 |
namespace spvtools { |
| 23 |
namespace fuzz { |
| 24 |
|
| 25 |
// A manually-crafter recommender of repeated passes, designed based on |
| 26 |
// knowledge of how the various fuzzer passes work and speculation as to how |
| 27 |
// they might interact in interesting ways. |
| 28 |
class RepeatedPassRecommenderStandard : public RepeatedPassRecommender { |
| 29 |
public: |
| 30 |
RepeatedPassRecommenderStandard(RepeatedPassInstances* pass_instances, |
| 31 |
FuzzerContext* fuzzer_context); |
| 32 |
|
| 33 |
~RepeatedPassRecommenderStandard(); |
| 34 |
|
| 35 |
std::vector<FuzzerPass*> GetFuturePassRecommendations( |
| 36 |
const FuzzerPass& pass) override; |
| 37 |
|
| 38 |
private: |
| 39 |
std::vector<FuzzerPass*> RandomOrderAndNonNull( |
| 40 |
const std::vector<FuzzerPass*>& passes); |
| 41 |
|
| 42 |
RepeatedPassInstances* pass_instances_; |
| 43 |
|
| 44 |
FuzzerContext* fuzzer_context_; |
| 45 |
}; |
| 46 |
|
| 47 |
} // namespace fuzz |
| 48 |
} // namespace spvtools |
| 49 |
|
| 50 |
#endif // SOURCE_FUZZ_REPEATED_PASS_RECOMMENDER_STANDARD_H_ |