Skip to content

Coverage goal filters aren't messaget #5589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions src/goto-instrument/cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,9 @@ cover_configt get_cover_config(
std::unique_ptr<goal_filterst> &goal_filters = cover_config.goal_filters;
cover_instrumenterst &instrumenters = cover_config.cover_instrumenters;

function_filters.add(
util_make_unique<internal_functions_filtert>(message_handler));
function_filters.add(util_make_unique<internal_functions_filtert>());

goal_filters->add(util_make_unique<internal_goals_filtert>(message_handler));
goal_filters->add(util_make_unique<internal_goals_filtert>());

optionst::value_listt criteria_strings = options.get_list_option("cover");

Expand Down Expand Up @@ -215,13 +214,11 @@ cover_configt get_cover_config(
if(!cover_include_pattern.empty())
{
function_filters.add(
util_make_unique<include_pattern_filtert>(
message_handler, cover_include_pattern));
util_make_unique<include_pattern_filtert>(cover_include_pattern));
}

if(options.get_bool_option("no-trivial-tests"))
function_filters.add(
util_make_unique<trivial_functions_filtert>(message_handler));
function_filters.add(util_make_unique<trivial_functions_filtert>());

cover_config.traces_must_terminate =
options.get_bool_option("cover-traces-must-terminate");
Expand Down Expand Up @@ -251,14 +248,14 @@ cover_configt get_cover_config(
if(cover_only == "function")
{
const symbolt &main_symbol = symbol_table.lookup_ref(main_function_id);
cover_config.function_filters.add(util_make_unique<single_function_filtert>(
message_handler, main_symbol.name));
cover_config.function_filters.add(
util_make_unique<single_function_filtert>(main_symbol.name));
}
else if(cover_only == "file")
{
const symbolt &main_symbol = symbol_table.lookup_ref(main_function_id);
cover_config.function_filters.add(util_make_unique<file_filtert>(
message_handler, main_symbol.location.get_file()));
cover_config.function_filters.add(
util_make_unique<file_filtert>(main_symbol.location.get_file()));
}
else if(!cover_only.empty())
{
Expand Down
48 changes: 7 additions & 41 deletions src/goto-instrument/cover_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ Author: Daniel Kroening
#include <memory>

#include <util/invariant.h>
#include <util/message.h>
#include <util/symbol.h>

#include <goto-programs/goto_model.h>

/// Base class for filtering functions
class function_filter_baset : public messaget
class function_filter_baset
{
public:
explicit function_filter_baset(message_handlert &message_handler)
: messaget(message_handler)
{
}

virtual ~function_filter_baset()
{
}
Expand All @@ -48,14 +42,9 @@ class function_filter_baset : public messaget
};

/// Base class for filtering goals
class goal_filter_baset : public messaget
class goal_filter_baset
{
public:
explicit goal_filter_baset(message_handlert &message_handler)
: messaget(message_handler)
{
}

virtual ~goal_filter_baset()
{
}
Expand Down Expand Up @@ -146,11 +135,6 @@ class goal_filterst
class internal_functions_filtert : public function_filter_baset
{
public:
explicit internal_functions_filtert(message_handlert &message_handler)
: function_filter_baset(message_handler)
{
}

bool operator()(
const symbolt &identifier,
const goto_functionst::goto_functiont &goto_function) const override;
Expand All @@ -159,10 +143,7 @@ class internal_functions_filtert : public function_filter_baset
class file_filtert : public function_filter_baset
{
public:
explicit file_filtert(
message_handlert &message_handler,
const irep_idt &file_id)
: function_filter_baset(message_handler), file_id(file_id)
explicit file_filtert(const irep_idt &file_id) : file_id(file_id)
{
}

Expand All @@ -177,10 +158,8 @@ class file_filtert : public function_filter_baset
class single_function_filtert : public function_filter_baset
{
public:
explicit single_function_filtert(
message_handlert &message_handler,
const irep_idt &function_id)
: function_filter_baset(message_handler), function_id(function_id)
explicit single_function_filtert(const irep_idt &function_id)
: function_id(function_id)
{
}

Expand All @@ -196,11 +175,8 @@ class single_function_filtert : public function_filter_baset
class include_pattern_filtert : public function_filter_baset
{
public:
explicit include_pattern_filtert(
message_handlert &message_handler,
const std::string &cover_include_pattern)
: function_filter_baset(message_handler),
regex_matcher(cover_include_pattern)
explicit include_pattern_filtert(const std::string &cover_include_pattern)
: regex_matcher(cover_include_pattern)
{
}

Expand All @@ -216,11 +192,6 @@ class include_pattern_filtert : public function_filter_baset
class trivial_functions_filtert : public function_filter_baset
{
public:
explicit trivial_functions_filtert(message_handlert &message_handler)
: function_filter_baset(message_handler)
{
}

bool operator()(
const symbolt &identifier,
const goto_functionst::goto_functiont &goto_function) const override;
Expand All @@ -230,11 +201,6 @@ class trivial_functions_filtert : public function_filter_baset
class internal_goals_filtert : public goal_filter_baset
{
public:
explicit internal_goals_filtert(message_handlert &message_handler)
: goal_filter_baset(message_handler)
{
}

bool operator()(const source_locationt &) const override;
};

Expand Down