From f7cf3ec2a5f664078bd10f1d72c7c8a49d5fab53 Mon Sep 17 00:00:00 2001 From: Alastair Donaldson Date: Wed, 10 Mar 2021 15:37:14 +0000 Subject: [PATCH] spirv-fuzz: Avoid unnecessary dependency (#4165) The fuzzer library depended on CLIMessageConsumer, due to its explicit use in a function. This change removes that dependency so that, instead, a message consumer parameter is passed. --- source/fuzz/force_render_red.cpp | 4 +--- source/fuzz/force_render_red.h | 2 +- tools/fuzz/fuzz.cpp | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/source/fuzz/force_render_red.cpp b/source/fuzz/force_render_red.cpp index fd0587a3..3267487a 100644 --- a/source/fuzz/force_render_red.cpp +++ b/source/fuzz/force_render_red.cpp @@ -19,12 +19,10 @@ #include "source/fuzz/protobufs/spirvfuzz_protobufs.h" #include "source/fuzz/transformation_context.h" #include "source/fuzz/transformation_replace_constant_with_uniform.h" -#include "source/fuzz/uniform_buffer_element_descriptor.h" #include "source/opt/build_module.h" #include "source/opt/ir_context.h" #include "source/opt/types.h" #include "source/util/make_unique.h" -#include "tools/util/cli_consumer.h" namespace spvtools { namespace fuzz { @@ -160,8 +158,8 @@ bool ForceRenderRed( const spv_target_env& target_env, spv_validator_options validator_options, const std::vector& binary_in, const spvtools::fuzz::protobufs::FactSequence& initial_facts, + const MessageConsumer& message_consumer, std::vector* binary_out) { - auto message_consumer = spvtools::utils::CLIMessageConsumer; spvtools::SpirvTools tools(target_env); if (!tools.IsValid()) { message_consumer(SPV_MSG_ERROR, nullptr, {}, diff --git a/source/fuzz/force_render_red.h b/source/fuzz/force_render_red.h index b51c72b4..5b8eab1b 100644 --- a/source/fuzz/force_render_red.h +++ b/source/fuzz/force_render_red.h @@ -41,7 +41,7 @@ bool ForceRenderRed( const spv_target_env& target_env, spv_validator_options validator_options, const std::vector& binary_in, const spvtools::fuzz::protobufs::FactSequence& initial_facts, - std::vector* binary_out); + const MessageConsumer& message_consumer, std::vector* binary_out); } // namespace fuzz } // namespace spvtools diff --git a/tools/fuzz/fuzz.cpp b/tools/fuzz/fuzz.cpp index a93d26ac..4400e0c0 100644 --- a/tools/fuzz/fuzz.cpp +++ b/tools/fuzz/fuzz.cpp @@ -721,9 +721,9 @@ int main(int argc, const char** argv) { switch (status.action) { case FuzzActions::FORCE_RENDER_RED: - if (!spvtools::fuzz::ForceRenderRed(target_env, validator_options, - binary_in, initial_facts, - &binary_out)) { + if (!spvtools::fuzz::ForceRenderRed( + target_env, validator_options, binary_in, initial_facts, + spvtools::utils::CLIMessageConsumer, &binary_out)) { return 1; } break;