Skip to content

Templatize value-set analysis #1499

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 4 commits into from
Nov 26, 2017
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
1 change: 0 additions & 1 deletion src/pointer-analysis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ SRC = add_failed_symbols.cpp \
value_set_analysis_fivr.cpp \
value_set_analysis_fivrns.cpp \
value_set_dereference.cpp \
value_set_domain.cpp \
value_set_domain_fi.cpp \
value_set_domain_fivr.cpp \
value_set_domain_fivrns.cpp \
Expand Down
2 changes: 1 addition & 1 deletion src/pointer-analysis/show_value_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Author: Daniel Kroening, [email protected]
#ifndef CPROVER_POINTER_ANALYSIS_SHOW_VALUE_SETS_H
#define CPROVER_POINTER_ANALYSIS_SHOW_VALUE_SETS_H

#include <pointer-analysis/value_set_analysis.h>
#include <util/ui_message.h>

class goto_modelt;
class value_set_analysist;

void show_value_sets(
ui_message_handlert::uit,
Expand Down
17 changes: 15 additions & 2 deletions src/pointer-analysis/value_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Author: Daniel Kroening, [email protected]

#include "add_failed_symbols.h"

// Due to a large number of functions defined inline, `value_sett` and
// associated types are documented in its header file, `value_set.h`.

const value_sett::object_map_dt value_sett::object_map_dt::blank{};
object_numberingt value_sett::object_numbering;

Expand Down Expand Up @@ -1205,6 +1208,12 @@ void value_sett::assign(
object_mapt values_rhs;
get_value_set(rhs, values_rhs, ns, is_simplified);

// Permit custom subclass to alter the read values prior to write:
adjust_assign_rhs_values(rhs, ns, values_rhs);

// Permit custom subclass to perform global side-effects prior to write:
apply_assign_side_effects(lhs, rhs, ns);

assign_rec(lhs, values_rhs, "", ns, add_to_sets);
}
}
Expand Down Expand Up @@ -1484,7 +1493,7 @@ void value_sett::do_end_function(
assign(lhs, rhs, ns, false, false);
}

void value_sett::apply_code(
void value_sett::apply_code_rec(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I agree this is a slightly better name: is the renaming essential?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case for this was: it's better to rename this and override the private function than to override the public apply_code, thus separating the customisation point (apply_code_rec) from the public interface (apply_code).

const codet &code,
const namespacet &ns)
{
Expand All @@ -1493,7 +1502,7 @@ void value_sett::apply_code(
if(statement==ID_block)
{
forall_operands(it, code)
apply_code(to_code(*it), ns);
apply_code_rec(to_code(*it), ns);
}
else if(statement==ID_function_call)
{
Expand Down Expand Up @@ -1611,6 +1620,10 @@ void value_sett::apply_code(
{
// doesn't do anything
}
else if(statement==ID_dead)
{
// Ignore by default; could prune the value set.
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unrelated change that would warrant a dedicated commit I'd say.

else
{
// std::cerr << code.pretty() << '\n';
Expand Down
Loading