Skip to content

Commit c3ee142

Browse files
committed
Adding in new NULL_object ID to properly represent the string.
1 parent 7a38669 commit c3ee142

17 files changed

+26
-28
lines changed

src/analyses/ai.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ bool ai_baset::do_function_call_rec(
506506
// We can't really do this here -- we rely on
507507
// these being removed by some previous analysis.
508508
}
509-
else if(function.id()=="NULL-object")
509+
else if(function.id()==ID_NULL_object)
510510
{
511511
// ignore, can't be a function
512512
}

src/analyses/flow_insensitive_analysis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ bool flow_insensitive_analysis_baset::do_function_call_rec(
371371
}
372372
}
373373
}
374-
else if(function.id()=="NULL-object")
374+
else if(function.id()==ID_NULL_object)
375375
{
376376
// ignore, can't be a function
377377
}

src/analyses/goto_rw.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void rw_range_sett::get_objects_index(
242242
const range_spect &range_start,
243243
const range_spect &size)
244244
{
245-
if(expr.array().id()=="NULL-object")
245+
if(expr.array().id()==ID_NULL_object)
246246
return;
247247

248248
range_spect sub_size=0;
@@ -416,7 +416,7 @@ void rw_range_sett::get_objects_address_of(const exprt &object)
416416
if(object.id()==ID_string_constant ||
417417
object.id()==ID_label ||
418418
object.id()==ID_array ||
419-
object.id()=="NULL-object")
419+
object.id()==ID_NULL_object)
420420
// constant, nothing to do
421421
return;
422422
else if(object.id()==ID_symbol)
@@ -558,7 +558,7 @@ void rw_range_sett::get_objects_rec(
558558
forall_operands(it, expr)
559559
get_objects_rec(mode, *it);
560560
}
561-
else if(expr.id()=="NULL-object" ||
561+
else if(expr.id()==ID_NULL_object ||
562562
expr.id()==ID_string_constant)
563563
{
564564
// dereferencing may yield some weird ones, ignore these

src/analyses/invariant_set.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ void invariant_sett::modifies(const exprt &lhs)
10361036
assert(lhs.operands().size()==2);
10371037
modifies(lhs.op0());
10381038
}
1039-
else if(lhs.id()=="NULL-object" ||
1039+
else if(lhs.id()==ID_NULL_object ||
10401040
lhs.id()=="is_zero_string" ||
10411041
lhs.id()=="zero_string" ||
10421042
lhs.id()=="zero_string_length")

src/analyses/static_analysis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ void static_analysis_baset::do_function_call_rec(
397397
}
398398
}
399399
}
400-
else if(function.id()=="NULL-object" ||
400+
else if(function.id()==ID_NULL_object ||
401401
function.id()==ID_integer_address)
402402
{
403403
// ignore, can't be a function

src/ansi-c/expr2c.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -3555,10 +3555,7 @@ std::string expr2ct::convert_with_precedence(
35553555
else if(src.id()=="pointer_difference")
35563556
return convert_pointer_difference(src, precedence=16);
35573557

3558-
else if(src.id()=="NULL-object")
3559-
return "NULL-object";
3560-
3561-
else if(src.id()==ID_null_object)
3558+
else if(src.id()==ID_null_object || src.id()==ID_NULL_object)
35623559
return "NULL-object";
35633560

35643561
else if(src.id()==ID_integer_address ||

src/goto-programs/goto_convert_function_call.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void goto_convertt::do_function_call(
7171
do_function_call_symbol(
7272
new_lhs, to_symbol_expr(new_function), new_arguments, dest);
7373
}
74-
else if(new_function.id()=="NULL-object")
74+
else if(new_function.id()==ID_NULL_object)
7575
{
7676
}
7777
else if(new_function.id()==ID_dereference ||

src/goto-programs/string_abstraction.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ exprt string_abstractiont::build_unknown(whatt what, bool write)
894894
typet type=build_type(what);
895895

896896
if(write)
897-
return exprt("NULL-object", type);
897+
return exprt(ID_NULL_object, type);
898898

899899
exprt result;
900900

@@ -916,7 +916,7 @@ exprt string_abstractiont::build_unknown(whatt what, bool write)
916916
exprt string_abstractiont::build_unknown(const typet &type, bool write)
917917
{
918918
if(write)
919-
return exprt("NULL-object", type);
919+
return exprt(ID_NULL_object, type);
920920

921921
// create an uninitialized dummy symbol
922922
// because of a lack of contextual information we can't build a nice name

src/goto-symex/symex_assign.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void goto_symext::symex_assign_rec(
151151
symex_assign_typecast(
152152
state, to_typecast_expr(lhs), full_lhs, rhs, guard, assignment_type);
153153
else if(lhs.id()==ID_string_constant ||
154-
lhs.id()=="NULL-object" ||
154+
lhs.id()==ID_NULL_object ||
155155
lhs.id()=="zero_string" ||
156156
lhs.id()=="is_zero_string" ||
157157
lhs.id()=="zero_string_length")
@@ -355,7 +355,7 @@ void goto_symext::symex_assign_struct_member(
355355
{
356356
assert(lhs_struct.operands().size()==1);
357357

358-
if(lhs_struct.op0().id()=="NULL-object")
358+
if(lhs_struct.op0().id()==ID_NULL_object)
359359
{
360360
// ignore, and give up
361361
return;

src/goto-symex/symex_other.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void goto_symext::havoc_rec(
3434
lhs=dest;
3535
else
3636
lhs=if_exprt(
37-
guard.as_expr(), dest, exprt("NULL-object", dest.type()));
37+
guard.as_expr(), dest, exprt(ID_NULL_object, dest.type()));
3838

3939
code_assignt assignment;
4040
assignment.lhs()=lhs;

src/pointer-analysis/value_set.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void value_sett::get_value_set_rec(
507507
if(expr.get(ID_value)==ID_NULL &&
508508
expr_type.id()==ID_pointer)
509509
{
510-
insert(dest, exprt("NULL-object", expr_type.subtype()), 0);
510+
insert(dest, exprt(ID_NULL_object, expr_type.subtype()), 0);
511511
}
512512
else if(expr_type.id()==ID_unsignedbv ||
513513
expr_type.id()==ID_signedbv)
@@ -538,7 +538,7 @@ void value_sett::get_value_set_rec(
538538
// integer-to-pointer
539539

540540
if(expr.op0().is_zero())
541-
insert(dest, exprt("NULL-object", expr_type.subtype()), 0);
541+
insert(dest, exprt(ID_NULL_object, expr_type.subtype()), 0);
542542
else
543543
{
544544
// see if we have something for the integer
@@ -1409,7 +1409,7 @@ void value_sett::assign_rec(
14091409
// someone writes into a string-constant
14101410
// evil guy
14111411
}
1412-
else if(lhs.id()=="NULL-object")
1412+
else if(lhs.id()==ID_NULL_object)
14131413
{
14141414
// evil as well
14151415
}

src/pointer-analysis/value_set_dereference.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ value_set_dereferencet::valuet value_set_dereferencet::build_reference_to(
301301

302302
valuet result;
303303

304-
if(root_object.id()=="NULL-object")
304+
if(root_object.id()==ID_NULL_object)
305305
{
306306
if(options.get_bool_option("pointer-check"))
307307
{

src/pointer-analysis/value_set_fi.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ void value_set_fit::get_value_set_rec(
528528
if(expr.get(ID_value)==ID_NULL &&
529529
expr.type().id()==ID_pointer)
530530
{
531-
insert(dest, exprt("NULL-object", expr.type().subtype()), 0);
531+
insert(dest, exprt(ID_NULL_object, expr.type().subtype()), 0);
532532
return;
533533
}
534534
}
@@ -1318,7 +1318,7 @@ void value_set_fit::assign_rec(
13181318
// someone writes into a string-constant
13191319
// evil guy
13201320
}
1321-
else if(lhs.id()=="NULL-object")
1321+
else if(lhs.id()==ID_NULL_object)
13221322
{
13231323
// evil as well
13241324
}

src/pointer-analysis/value_set_fivr.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ void value_set_fivrt::get_value_set_rec(
645645
if(expr.get(ID_value)==ID_NULL &&
646646
expr.type().id()==ID_pointer)
647647
{
648-
insert_from(dest, exprt("NULL-object", expr.type().subtype()), 0);
648+
insert_from(dest, exprt(ID_NULL_object, expr.type().subtype()), 0);
649649
return;
650650
}
651651
}
@@ -1456,7 +1456,7 @@ void value_set_fivrt::assign_rec(
14561456
// someone writes into a string-constant
14571457
// evil guy
14581458
}
1459-
else if(lhs.id()=="NULL-object")
1459+
else if(lhs.id()==ID_NULL_object)
14601460
{
14611461
// evil as well
14621462
}

src/pointer-analysis/value_set_fivrns.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ void value_set_fivrnst::get_value_set_rec(
434434
if(expr.get(ID_value)==ID_NULL &&
435435
expr.type().id()==ID_pointer)
436436
{
437-
insert_from(dest, exprt("NULL-object", expr.type().subtype()), 0);
437+
insert_from(dest, exprt(ID_NULL_object, expr.type().subtype()), 0);
438438
return;
439439
}
440440
}
@@ -1112,7 +1112,7 @@ void value_set_fivrnst::assign_rec(
11121112
// someone writes into a string-constant
11131113
// evil guy
11141114
}
1115-
else if(lhs.id()=="NULL-object")
1115+
else if(lhs.id()==ID_NULL_object)
11161116
{
11171117
// evil as well
11181118
}

src/solvers/flattening/bv_pointers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ bool bv_pointerst::convert_address_of_rec(
116116
add_addr(expr, bv);
117117
return false;
118118
}
119-
else if(expr.id()=="NULL-object")
119+
else if(expr.id()==ID_NULL_object)
120120
{
121121
encode(pointer_logic.get_null_object(), bv);
122122
return false;

src/util/irep_ids.def

+1
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ IREP_ID_ONE(good_pointer)
527527
IREP_ID_ONE(integer_address)
528528
IREP_ID_ONE(integer_address_object)
529529
IREP_ID_ONE(null_object)
530+
IREP_ID_TWO(NULL_object, NULL-object)
530531
IREP_ID_ONE(static_object)
531532
IREP_ID_ONE(stack_object)
532533
IREP_ID_TWO(C_is_failed_symbol, #is_failed_symbol)

0 commit comments

Comments
 (0)