Skip to content

remove unused member_exprt::symbol() #2860

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
Sep 4, 2018
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
26 changes: 19 additions & 7 deletions jbmc/unit/java-testing-utils/require_goto_statements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ require_goto_statements::require_entry_point_statements(
/// \param structure_name: The name of variable of type struct
/// \param superclass_name: The name of the superclass (if given)
/// \param component_name: The name of the component of the superclass that
/// \param symbol_table: A symbol table to enable type lookups
/// should be assigned
/// \return: All the assignments to that component.
require_goto_statements::pointer_assignment_locationt
require_goto_statements::find_struct_component_assignments(
const std::vector<codet> &statements,
const irep_idt &structure_name,
const optionalt<irep_idt> &superclass_name,
const irep_idt &component_name)
const irep_idt &component_name,
const symbol_tablet &symbol_table)
{
pointer_assignment_locationt locations;

Expand Down Expand Up @@ -97,9 +99,13 @@ require_goto_statements::find_struct_component_assignments(
const irep_idt supercomponent_name =
"@" + id2string(superclass_name.value());

object_descriptor_exprt ode;
const namespacet ns(symbol_table);
ode.build(superclass_expr, ns);
if(
superclass_expr.get_component_name() == supercomponent_name &&
superclass_expr.symbol().get_identifier() == structure_name)
to_symbol_expr(ode.root_object()).get_identifier() ==
structure_name)
{
if(
code_assign.rhs() ==
Expand All @@ -122,7 +128,7 @@ require_goto_statements::find_struct_component_assignments(
// - operand (component of): symbol for \p structure_name
if(
member_expr.op().id() == ID_symbol &&
member_expr.symbol().get_identifier() == structure_name &&
to_symbol_expr(member_expr.op()).get_identifier() == structure_name &&
member_expr.get_component_name() == component_name)
{
if(
Expand Down Expand Up @@ -291,14 +297,16 @@ const code_declt &require_goto_statements::require_declaration_of_name(
/// \param typecast_name The name of the type to which the object is cast (if
/// there is a typecast)
/// \param entry_point_instructions The statements to look through
/// \param symbol_table: A symbol table to enable type lookups
/// \return The identifier of the variable assigned to the field
const irep_idt &require_goto_statements::require_struct_component_assignment(
const irep_idt &structure_name,
const optionalt<irep_idt> &superclass_name,
const irep_idt &component_name,
const irep_idt &component_type_name,
const optionalt<irep_idt> &typecast_name,
const std::vector<codet> &entry_point_instructions)
const std::vector<codet> &entry_point_instructions,
const symbol_tablet &symbol_table)
{
// First we need to find the assignments to the component belonging to
// the structure_name object
Expand All @@ -307,7 +315,8 @@ const irep_idt &require_goto_statements::require_struct_component_assignment(
entry_point_instructions,
structure_name,
superclass_name,
component_name);
component_name,
symbol_table);
REQUIRE(component_assignments.non_null_assignments.size() == 1);

// We are expecting that the resulting statement can be of two forms:
Expand Down Expand Up @@ -376,6 +385,7 @@ const irep_idt &require_goto_statements::require_struct_component_assignment(
/// \param array_type_name The type of the array, e.g., java::array[reference]
/// \param array_component_element_type_name The element type of the array
/// \param entry_point_instructions The statements to look through
/// \param symbol_table: A symbol table to enable type lookups
/// \return The identifier of the variable assigned to the field
const irep_idt &
require_goto_statements::require_struct_array_component_assignment(
Expand All @@ -384,7 +394,8 @@ require_goto_statements::require_struct_array_component_assignment(
const irep_idt &array_component_name,
const irep_idt &array_type_name,
const irep_idt &array_component_element_type_name,
const std::vector<codet> &entry_point_instructions)
const std::vector<codet> &entry_point_instructions,
const symbol_tablet &symbol_table)
{
// First we need to find the assignments to the component belonging to
// the structure_name object
Expand All @@ -393,7 +404,8 @@ require_goto_statements::require_struct_array_component_assignment(
entry_point_instructions,
structure_name,
superclass_name,
array_component_name);
array_component_name,
symbol_table);
REQUIRE(component_assignments.non_null_assignments.size() == 1);

// We are expecting that the resulting statement is of form:
Expand Down
9 changes: 6 additions & 3 deletions jbmc/unit/java-testing-utils/require_goto_statements.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ pointer_assignment_locationt find_struct_component_assignments(
const std::vector<codet> &statements,
const irep_idt &structure_name,
const optionalt<irep_idt> &superclass_name,
const irep_idt &component_name);
const irep_idt &component_name,
const symbol_tablet &symbol_table);

pointer_assignment_locationt find_this_component_assignment(
const std::vector<codet> &statements,
Expand Down Expand Up @@ -82,15 +83,17 @@ const irep_idt &require_struct_component_assignment(
const irep_idt &component_name,
const irep_idt &component_type_name,
const optionalt<irep_idt> &typecast_name,
const std::vector<codet> &entry_point_instructions);
const std::vector<codet> &entry_point_instructions,
const symbol_tablet &symbol_table);

const irep_idt &require_struct_array_component_assignment(
const irep_idt &structure_name,
const optionalt<irep_idt> &superclass_name,
const irep_idt &array_component_name,
const irep_idt &array_type_name,
const irep_idt &array_component_element_type_name,
const std::vector<codet> &entry_point_instructions);
const std::vector<codet> &entry_point_instructions,
const symbol_tablet &symbol_table);

const irep_idt &require_entry_point_argument_assignment(
const irep_idt &argument_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ SCENARIO(
"field",
"java::java.lang.Integer",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -90,7 +91,8 @@ SCENARIO(
"field",
"java::IWrapper",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -122,7 +124,8 @@ SCENARIO(
"field",
"java::Wrapper",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);

THEN("Object 'this.field' has correctly specialized field")
{
Expand All @@ -132,7 +135,8 @@ SCENARIO(
"field",
"java::IWrapper",
{},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -167,7 +171,8 @@ SCENARIO(
"f",
"java::SuperclassUninst",
{},
entry_point_code);
entry_point_code,
symbol_table);

THEN("The object for 'f' has correctly specialized inherited field")
{
Expand All @@ -177,7 +182,8 @@ SCENARIO(
"field",
"java::java.lang.Integer",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -210,7 +216,8 @@ SCENARIO(
"f",
"java::SuperclassMixed",
{},
entry_point_code);
entry_point_code,
symbol_table);

THEN("The object for 'f' has correctly specialized inherited fields")
{
Expand All @@ -220,15 +227,17 @@ SCENARIO(
"first",
"java::java.lang.Boolean",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);

require_goto_statements::require_struct_component_assignment(
f_tmp_name,
{"PairWrapper"},
"second",
"java::IWrapper",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -265,7 +274,8 @@ SCENARIO(
"inner",
"java::SuperclassInnerInst$Inner",
{},
entry_point_code);
entry_point_code,
symbol_table);
THEN(
"The object of 'inner' has correctly specialized inherited "
"field")
Expand All @@ -276,7 +286,8 @@ SCENARIO(
"field",
"java::java.lang.Integer",
{},
entry_point_code);
entry_point_code,
symbol_table);
}

const irep_idt &inner_gen_tmp_name =
Expand All @@ -286,7 +297,8 @@ SCENARIO(
"inner_gen",
"java::SuperclassInnerInst$InnerGen",
{},
entry_point_code);
entry_point_code,
symbol_table);
THEN(
"The object of 'inner_gen' has correctly specialized inherited "
"field")
Expand All @@ -297,7 +309,8 @@ SCENARIO(
"field",
"java::java.lang.Boolean",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -334,7 +347,8 @@ SCENARIO(
"f",
"java::SuperclassInnerUninst",
{},
entry_point_code);
entry_point_code,
symbol_table);

THEN(
"The object for 'f' has fields 'inner' and 'inner_gen' "
Expand All @@ -347,7 +361,8 @@ SCENARIO(
"inner",
"java::SuperclassInnerUninst$Inner",
{},
entry_point_code);
entry_point_code,
symbol_table);
THEN(
"The object of 'inner' has correctly specialized inherited "
"field")
Expand All @@ -358,7 +373,8 @@ SCENARIO(
"field",
"java::IWrapper",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}

const irep_idt &inner_gen_tmp_name =
Expand All @@ -368,7 +384,8 @@ SCENARIO(
"inner_gen",
"java::SuperclassInnerUninst$InnerGen",
{},
entry_point_code);
entry_point_code,
symbol_table);
THEN(
"The object of 'inner_gen' has correctly specialized inherited "
"fields")
Expand All @@ -379,14 +396,16 @@ SCENARIO(
"first",
"java::IWrapper",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
require_goto_statements::require_struct_component_assignment(
inner_gen_tmp_name,
{"PairWrapper"},
"second",
"java::java.lang.Boolean",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}

const irep_idt &inner_three_tmp_name =
Expand All @@ -396,7 +415,8 @@ SCENARIO(
"inner_three",
"java::SuperclassInnerUninst$InnerThree",
{},
entry_point_code);
entry_point_code,
symbol_table);
THEN(
"The object of 'inner_three' has correctly specialized "
"inherited fields")
Expand All @@ -407,7 +427,8 @@ SCENARIO(
"field",
"java::IWrapper",
{"java::java.lang.Object"},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -463,7 +484,8 @@ SCENARIO(
"field",
"java::java.lang.Object",
{},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down Expand Up @@ -506,7 +528,8 @@ SCENARIO(
"field",
"java::java.lang.Object",
{},
entry_point_code);
entry_point_code,
symbol_table);
}
}
}
Expand Down
Loading