Skip to content

[SEC-346] irep_ids: Adding in a NULL-object ID #2048

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
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
2 changes: 1 addition & 1 deletion src/analyses/ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ bool ai_baset::do_function_call_rec(
// We can't really do this here -- we rely on
// these being removed by some previous analysis.
}
else if(function.id()=="NULL-object")
else if(function.id() == ID_null_object)
{
// ignore, can't be a function
}
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/flow_insensitive_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ bool flow_insensitive_analysis_baset::do_function_call_rec(
}
}
}
else if(function.id()=="NULL-object")
else if(function.id() == ID_null_object)
{
// ignore, can't be a function
}
Expand Down
14 changes: 7 additions & 7 deletions src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void rw_range_sett::get_objects_index(
const range_spect &range_start,
const range_spect &size)
{
if(expr.array().id()=="NULL-object")
if(expr.array().id() == ID_null_object)
return;

range_spect sub_size=0;
Expand Down Expand Up @@ -413,10 +413,10 @@ void rw_range_sett::get_objects_typecast(

void rw_range_sett::get_objects_address_of(const exprt &object)
{
if(object.id()==ID_string_constant ||
object.id()==ID_label ||
object.id()==ID_array ||
object.id()=="NULL-object")
if(object.id() == ID_string_constant ||
object.id() == ID_label ||
object.id() == ID_array ||
object.id() == ID_null_object)
// constant, nothing to do
return;
else if(object.id()==ID_symbol)
Expand Down Expand Up @@ -558,8 +558,8 @@ void rw_range_sett::get_objects_rec(
forall_operands(it, expr)
get_objects_rec(mode, *it);
}
else if(expr.id()=="NULL-object" ||
expr.id()==ID_string_constant)
else if(expr.id() == ID_null_object ||
expr.id() == ID_string_constant)
{
// dereferencing may yield some weird ones, ignore these
}
Expand Down
8 changes: 4 additions & 4 deletions src/analyses/invariant_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,10 +1036,10 @@ void invariant_sett::modifies(const exprt &lhs)
assert(lhs.operands().size()==2);
modifies(lhs.op0());
}
else if(lhs.id()=="NULL-object" ||
lhs.id()=="is_zero_string" ||
lhs.id()=="zero_string" ||
lhs.id()=="zero_string_length")
else if(lhs.id() == ID_null_object ||
lhs.id() == "is_zero_string" ||
lhs.id() == "zero_string" ||
lhs.id() == "zero_string_length")
{
// ignore
}
Expand Down
4 changes: 2 additions & 2 deletions src/analyses/static_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ void static_analysis_baset::do_function_call_rec(
}
}
}
else if(function.id()=="NULL-object" ||
function.id()==ID_integer_address)
else if(function.id() == ID_null_object ||
function.id() == ID_integer_address)
{
// ignore, can't be a function
}
Expand Down
5 changes: 1 addition & 4 deletions src/ansi-c/expr2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3555,10 +3555,7 @@ std::string expr2ct::convert_with_precedence(
else if(src.id()=="pointer_difference")
return convert_pointer_difference(src, precedence=16);

else if(src.id()=="NULL-object")
return "NULL-object";

else if(src.id()==ID_null_object)
else if(src.id() == ID_null_object)
return "NULL-object";

else if(src.id()==ID_integer_address ||
Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/goto_convert_function_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void goto_convertt::do_function_call(
do_function_call_symbol(
new_lhs, to_symbol_expr(new_function), new_arguments, dest);
}
else if(new_function.id()=="NULL-object")
else if(new_function.id() == ID_null_object)
{
}
else if(new_function.id()==ID_dereference ||
Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ void interpretert::build_memory_map()
{
// put in a dummy for NULL
memory.resize(1);
inverse_memory_map[0]="NULL-OBJECT";
inverse_memory_map[0] = ID_null_object;

num_dynamic_objects=0;
dynamic_types.clear();
Expand Down
4 changes: 2 additions & 2 deletions src/goto-programs/string_abstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ exprt string_abstractiont::build_unknown(whatt what, bool write)
typet type=build_type(what);

if(write)
return exprt("NULL-object", type);
return exprt(ID_null_object, type);

exprt result;

Expand All @@ -916,7 +916,7 @@ exprt string_abstractiont::build_unknown(whatt what, bool write)
exprt string_abstractiont::build_unknown(const typet &type, bool write)
{
if(write)
return exprt("NULL-object", type);
return exprt(ID_null_object, type);

// create an uninitialized dummy symbol
// because of a lack of contextual information we can't build a nice name
Expand Down
12 changes: 6 additions & 6 deletions src/goto-symex/symex_assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ void goto_symext::symex_assign_rec(
else if(lhs.id()==ID_typecast)
symex_assign_typecast(
state, to_typecast_expr(lhs), full_lhs, rhs, guard, assignment_type);
else if(lhs.id()==ID_string_constant ||
lhs.id()=="NULL-object" ||
lhs.id()=="zero_string" ||
lhs.id()=="is_zero_string" ||
lhs.id()=="zero_string_length")
else if(lhs.id() == ID_string_constant ||
lhs.id() == ID_null_object ||
lhs.id() == "zero_string" ||
lhs.id() == "is_zero_string" ||
lhs.id() == "zero_string_length")
{
// ignore
}
Expand Down Expand Up @@ -355,7 +355,7 @@ void goto_symext::symex_assign_struct_member(
{
assert(lhs_struct.operands().size()==1);

if(lhs_struct.op0().id()=="NULL-object")
if(lhs_struct.op0().id() == ID_null_object)
{
// ignore, and give up
return;
Expand Down
2 changes: 1 addition & 1 deletion src/goto-symex/symex_other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void goto_symext::havoc_rec(
lhs=dest;
else
lhs=if_exprt(
guard.as_expr(), dest, exprt("NULL-object", dest.type()));
guard.as_expr(), dest, exprt(ID_null_object, dest.type()));

code_assignt assignment;
assignment.lhs()=lhs;
Expand Down
6 changes: 3 additions & 3 deletions src/pointer-analysis/value_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ void value_sett::get_value_set_rec(
if(expr.get(ID_value)==ID_NULL &&
expr_type.id()==ID_pointer)
{
insert(dest, exprt("NULL-object", expr_type.subtype()), 0);
insert(dest, exprt(ID_null_object, expr_type.subtype()), 0);
}
else if(expr_type.id()==ID_unsignedbv ||
expr_type.id()==ID_signedbv)
Expand Down Expand Up @@ -538,7 +538,7 @@ void value_sett::get_value_set_rec(
// integer-to-pointer

if(expr.op0().is_zero())
insert(dest, exprt("NULL-object", expr_type.subtype()), 0);
insert(dest, exprt(ID_null_object, expr_type.subtype()), 0);
else
{
// see if we have something for the integer
Expand Down Expand Up @@ -1409,7 +1409,7 @@ void value_sett::assign_rec(
// someone writes into a string-constant
// evil guy
}
else if(lhs.id()=="NULL-object")
else if(lhs.id() == ID_null_object)
{
// evil as well
}
Expand Down
2 changes: 1 addition & 1 deletion src/pointer-analysis/value_set_dereference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ value_set_dereferencet::valuet value_set_dereferencet::build_reference_to(

valuet result;

if(root_object.id()=="NULL-object")
if(root_object.id() == ID_null_object)
{
if(options.get_bool_option("pointer-check"))
{
Expand Down
4 changes: 2 additions & 2 deletions src/pointer-analysis/value_set_fi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ void value_set_fit::get_value_set_rec(
if(expr.get(ID_value)==ID_NULL &&
expr.type().id()==ID_pointer)
{
insert(dest, exprt("NULL-object", expr.type().subtype()), 0);
insert(dest, exprt(ID_null_object, expr.type().subtype()), 0);
return;
}
}
Expand Down Expand Up @@ -1318,7 +1318,7 @@ void value_set_fit::assign_rec(
// someone writes into a string-constant
// evil guy
}
else if(lhs.id()=="NULL-object")
else if(lhs.id() == ID_null_object)
{
// evil as well
}
Expand Down
4 changes: 2 additions & 2 deletions src/pointer-analysis/value_set_fivr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ void value_set_fivrt::get_value_set_rec(
if(expr.get(ID_value)==ID_NULL &&
expr.type().id()==ID_pointer)
{
insert_from(dest, exprt("NULL-object", expr.type().subtype()), 0);
insert_from(dest, exprt(ID_null_object, expr.type().subtype()), 0);
return;
}
}
Expand Down Expand Up @@ -1456,7 +1456,7 @@ void value_set_fivrt::assign_rec(
// someone writes into a string-constant
// evil guy
}
else if(lhs.id()=="NULL-object")
else if(lhs.id() == ID_null_object)
{
// evil as well
}
Expand Down
4 changes: 2 additions & 2 deletions src/pointer-analysis/value_set_fivrns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ void value_set_fivrnst::get_value_set_rec(
if(expr.get(ID_value)==ID_NULL &&
expr.type().id()==ID_pointer)
{
insert_from(dest, exprt("NULL-object", expr.type().subtype()), 0);
insert_from(dest, exprt(ID_null_object, expr.type().subtype()), 0);
return;
}
}
Expand Down Expand Up @@ -1112,7 +1112,7 @@ void value_set_fivrnst::assign_rec(
// someone writes into a string-constant
// evil guy
}
else if(lhs.id()=="NULL-object")
else if(lhs.id() == ID_null_object)
{
// evil as well
}
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/flattening/bv_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ bool bv_pointerst::convert_address_of_rec(
add_addr(expr, bv);
return false;
}
else if(expr.id()=="NULL-object")
else if(expr.id() == ID_null_object)
{
encode(pointer_logic.get_null_object(), bv);
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/util/irep_ids.def
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ IREP_ID_ONE(object_size)
IREP_ID_ONE(good_pointer)
IREP_ID_ONE(integer_address)
IREP_ID_ONE(integer_address_object)
IREP_ID_ONE(null_object)
IREP_ID_TWO(null_object, NULL-object)
IREP_ID_ONE(static_object)
IREP_ID_ONE(stack_object)
IREP_ID_TWO(C_is_failed_symbol, #is_failed_symbol)
Expand Down
2 changes: 1 addition & 1 deletion unit/pointer-analysis/custom_value_set_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ SCENARIO("test_value_set_analysis",
REQUIRE(exprs_with_id(normal_exprs_after, ID_dynamic_object)==1);

REQUIRE(test_exprs_after.size()==1);
REQUIRE(exprs_with_id(test_exprs_after, "NULL-object")==1);
REQUIRE(exprs_with_id(test_exprs_after, ID_null_object)==1);
}
}
}
Expand Down