Skip to content

Commit 4e89e01

Browse files
author
Daniel Kroening
committed
use get_identifier() instead of get(ID_identifier) on symbols
1 parent 235fd05 commit 4e89e01

21 files changed

+138
-77
lines changed

src/analyses/ai.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ bool ai_baset::do_function_call_rec(
462462

463463
if(function.id()==ID_symbol)
464464
{
465-
const irep_idt &identifier=function.get(ID_identifier);
465+
const irep_idt &identifier=to_symbol_expr(function).get_identifier();
466466

467467
goto_functionst::function_mapt::const_iterator it=
468468
goto_functions.function_map.find(identifier);

src/ansi-c/c_typecast.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ typet c_typecastt::follow_with_qualifiers(const typet &src_type)
263263
while(result_type.id()==ID_symbol)
264264
{
265265
const symbolt &followed_type_symbol=
266-
ns.lookup(result_type.get(ID_identifier));
266+
ns.lookup(to_symbol_type(result_type));
267267

268268
result_type=followed_type_symbol.type;
269269
qualifiers+=c_qualifierst(followed_type_symbol.type);

src/ansi-c/expr2c.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ std::string expr2ct::convert_symbol(
16631663
const symbol_exprt &src,
16641664
unsigned &precedence)
16651665
{
1666-
const irep_idt &id=src.get(ID_identifier);
1666+
const irep_idt &id=src.get_identifier();
16671667
std::string dest;
16681668

16691669
if(src.operands().size()==1 &&

src/ansi-c/type2name.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/invariant.h>
1616
#include <util/namespace.h>
1717
#include <util/pointer_offset_size.h>
18+
#include <util/std_expr.h>
1819
#include <util/std_types.h>
1920
#include <util/symbol_table.h>
2021

@@ -25,12 +26,12 @@ static std::string type2name(
2526
const namespacet &ns,
2627
symbol_numbert &symbol_number);
2728

28-
static std::string type2name_symbol(
29-
const typet &type,
29+
static std::string type2name_tag(
30+
const tag_typet &type,
3031
const namespacet &ns,
3132
symbol_numbert &symbol_number)
3233
{
33-
const irep_idt &identifier=type.get(ID_identifier);
34+
const irep_idt &identifier=type.get_identifier();
3435

3536
const symbolt *symbol;
3637

@@ -180,7 +181,7 @@ static std::string type2name(
180181
const array_typet &t=to_array_type(type);
181182
mp_integer size;
182183
if(t.size().id()==ID_symbol)
183-
result+="ARR"+id2string(t.size().get(ID_identifier));
184+
result+="ARR"+id2string(to_symbol_expr(t.size()).get_identifier());
184185
else if(to_integer(t.size(), size))
185186
result+="ARR?";
186187
else
@@ -192,7 +193,7 @@ static std::string type2name(
192193
type.id()==ID_union_tag)
193194
{
194195
parent_is_sym_check=true;
195-
result+=type2name_symbol(type, ns, symbol_number);
196+
result+=type2name_tag(to_tag_type(type), ns, symbol_number);
196197
}
197198
else if(type.id()==ID_struct ||
198199
type.id()==ID_union)

src/goto-programs/builtin_functions.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ Author: Daniel Kroening, [email protected]
2929

3030
void goto_convertt::do_prob_uniform(
3131
const exprt &lhs,
32-
const exprt &function,
32+
const symbol_exprt &function,
3333
const exprt::operandst &arguments,
3434
goto_programt &dest)
3535
{
36-
const irep_idt &identifier=function.get(ID_identifier);
36+
const irep_idt &identifier=function.get_identifier();
3737

3838
// make it a side effect if there is an LHS
3939
if(arguments.size()!=2)
@@ -107,11 +107,11 @@ void goto_convertt::do_prob_uniform(
107107

108108
void goto_convertt::do_prob_coin(
109109
const exprt &lhs,
110-
const exprt &function,
110+
const symbol_exprt &function,
111111
const exprt::operandst &arguments,
112112
goto_programt &dest)
113113
{
114-
const irep_idt &identifier=function.get(ID_identifier);
114+
const irep_idt &identifier=function.get_identifier();
115115

116116
// make it a side effect if there is an LHS
117117
if(arguments.size()!=2)
@@ -184,11 +184,11 @@ void goto_convertt::do_prob_coin(
184184

185185
void goto_convertt::do_printf(
186186
const exprt &lhs,
187-
const exprt &function,
187+
const symbol_exprt &function,
188188
const exprt::operandst &arguments,
189189
goto_programt &dest)
190190
{
191-
const irep_idt &f_id=function.get(ID_identifier);
191+
const irep_idt &f_id=function.get_identifier();
192192

193193
if(f_id==CPROVER_PREFIX "printf" ||
194194
f_id=="printf")
@@ -219,11 +219,11 @@ void goto_convertt::do_printf(
219219

220220
void goto_convertt::do_scanf(
221221
const exprt &lhs,
222-
const exprt &function,
222+
const symbol_exprt &function,
223223
const exprt::operandst &arguments,
224224
goto_programt &dest)
225225
{
226-
const irep_idt &f_id=function.get(ID_identifier);
226+
const irep_idt &f_id=function.get_identifier();
227227

228228
if(f_id==CPROVER_PREFIX "scanf")
229229
{
@@ -364,7 +364,7 @@ void goto_convertt::do_output(
364364

365365
void goto_convertt::do_atomic_begin(
366366
const exprt &lhs,
367-
const exprt &function,
367+
const symbol_exprt &function,
368368
const exprt::operandst &arguments,
369369
goto_programt &dest)
370370
{
@@ -388,7 +388,7 @@ void goto_convertt::do_atomic_begin(
388388

389389
void goto_convertt::do_atomic_end(
390390
const exprt &lhs,
391-
const exprt &function,
391+
const symbol_exprt &function,
392392
const exprt::operandst &arguments,
393393
goto_programt &dest)
394394
{
@@ -597,7 +597,7 @@ exprt goto_convertt::get_array_argument(const exprt &src)
597597
void goto_convertt::do_array_op(
598598
const irep_idt &id,
599599
const exprt &lhs,
600-
const exprt &function,
600+
const symbol_exprt &function,
601601
const exprt::operandst &arguments,
602602
goto_programt &dest)
603603
{

src/goto-programs/goto_convert.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -658,16 +658,17 @@ void goto_convertt::convert_decl(
658658
goto_programt &dest,
659659
const irep_idt &mode)
660660
{
661-
const exprt &op0=code.op0();
661+
const exprt &op=code.symbol();
662662

663-
if(op0.id()!=ID_symbol)
663+
if(op.id()!=ID_symbol)
664664
{
665-
error().source_location=op0.find_source_location();
666-
error() << "decl statement expects symbol as first operand" << eom;
665+
error().source_location=op.find_source_location();
666+
error() << "decl statement expects symbol as operand" << eom;
667667
throw 0;
668668
}
669669

670-
const irep_idt &identifier=op0.get(ID_identifier);
670+
const irep_idt &identifier=
671+
to_symbol_expr(op).get_identifier();
671672

672673
const symbolt &symbol=lookup(identifier);
673674

src/goto-programs/goto_convert_class.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -609,38 +609,38 @@ class goto_convertt:public messaget
609609
// some built-in functions
610610
void do_atomic_begin(
611611
const exprt &lhs,
612-
const exprt &rhs,
612+
const symbol_exprt &function,
613613
const exprt::operandst &arguments,
614614
goto_programt &dest);
615615
void do_atomic_end(
616616
const exprt &lhs,
617-
const exprt &rhs,
617+
const symbol_exprt &function,
618618
const exprt::operandst &arguments,
619619
goto_programt &dest);
620620
void do_create_thread(
621621
const exprt &lhs,
622-
const exprt &rhs,
622+
const symbol_exprt &function,
623623
const exprt::operandst &arguments,
624624
goto_programt &dest);
625625
void do_array_equal(
626626
const exprt &lhs,
627-
const exprt &rhs,
627+
const symbol_exprt &rhs,
628628
const exprt::operandst &arguments,
629629
goto_programt &dest);
630630
void do_array_op(
631631
const irep_idt &id,
632632
const exprt &lhs,
633-
const exprt &function,
633+
const symbol_exprt &function,
634634
const exprt::operandst &arguments,
635635
goto_programt &dest);
636636
void do_printf(
637637
const exprt &lhs,
638-
const exprt &rhs,
638+
const symbol_exprt &function,
639639
const exprt::operandst &arguments,
640640
goto_programt &dest);
641641
void do_scanf(
642642
const exprt &lhs,
643-
const exprt &rhs,
643+
const symbol_exprt &function,
644644
const exprt::operandst &arguments,
645645
goto_programt &dest);
646646
void do_input(
@@ -655,12 +655,12 @@ class goto_convertt:public messaget
655655
goto_programt &dest);
656656
void do_prob_coin(
657657
const exprt &lhs,
658-
const exprt &rhs,
658+
const symbol_exprt &function,
659659
const exprt::operandst &arguments,
660660
goto_programt &dest);
661661
void do_prob_uniform(
662662
const exprt &lhs,
663-
const exprt &rhs,
663+
const symbol_exprt &function,
664664
const exprt::operandst &arguments,
665665
goto_programt &dest);
666666

src/goto-programs/goto_convert_side_effect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void goto_convertt::remove_function_call(
376376

377377
if(expr.op0().id()==ID_symbol)
378378
{
379-
const irep_idt &identifier=expr.op0().get(ID_identifier);
379+
const irep_idt &identifier=to_symbol_expr(expr.op0()).get_identifier();
380380
const symbolt &symbol=lookup(identifier);
381381

382382
std::string new_base_name=id2string(new_symbol.base_name);

src/goto-programs/interpreter.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,9 @@ void interpretert::execute_function_call()
838838
else
839839
{
840840
list_input_varst::iterator it=
841-
function_input_vars.find(function_call.function().get(ID_identifier));
841+
function_input_vars.find(
842+
to_symbol_expr(function_call.function()).get_identifier());
843+
842844
if(it!=function_input_vars.end())
843845
{
844846
mp_vectort value;
@@ -852,6 +854,7 @@ void interpretert::execute_function_call()
852854
it->second.pop_front();
853855
return;
854856
}
857+
855858
if(show)
856859
error() << "no body for "+id2string(identifier) << eom;
857860
}

src/goto-programs/interpreter_evaluate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ mp_integer interpretert::evaluate_address(
10861086
const irep_idt &identifier=
10871087
is_ssa_expr(expr) ?
10881088
to_ssa_expr(expr).get_original_name() :
1089-
expr.get(ID_identifier);
1089+
to_symbol_expr(expr).get_identifier();
10901090

10911091
interpretert::memory_mapt::const_iterator m_it1=
10921092
memory_map.find(identifier);

src/goto-programs/json_goto_trace.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ void convert_decl(
107107
{
108108
if(expr.id() == ID_symbol)
109109
{
110-
const symbolt &symbol = ns.lookup(expr.get(ID_identifier));
110+
const symbolt &symbol = ns.lookup(to_symbol_expr(expr));
111+
111112
if(expr.find(ID_C_base_name).is_not_nil())
112113
INVARIANT(
113114
expr.find(ID_C_base_name).id() == symbol.base_name,

src/goto-programs/remove_const_function_pointers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ exprt remove_const_function_pointerst::replace_const_symbols(
7373
if(is_const_expression(expression))
7474
{
7575
const symbolt &symbol=
76-
*symbol_table.lookup(expression.get(ID_identifier));
76+
*symbol_table.lookup(to_symbol_expr(expression).get_identifier());
7777
if(symbol.type.id()!=ID_code)
7878
{
7979
const exprt &symbol_value=symbol.value;

src/goto-programs/remove_unused_functions.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ void find_used_functions(
8181
// check that this is actually a simple call
8282
assert(call.function().id()==ID_symbol);
8383

84-
find_used_functions(call.function().get(ID_identifier),
85-
functions,
86-
seen);
84+
const irep_idt &identifier=
85+
to_symbol_expr(call.function()).get_identifier();
86+
87+
find_used_functions(identifier, functions, seen);
8788
}
8889
}
8990
}

src/memory-models/mm2cpp.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Author: Daniel Kroening, [email protected]
1212
#include <ostream>
1313

1414
#include <util/std_code.h>
15+
#include <util/std_expr.h>
1516

1617
class mm2cppt
1718
{
@@ -53,7 +54,7 @@ void mm2cppt::check_acyclic(const exprt &expr, unsigned indent)
5354
{
5455
if(expr.id()==ID_symbol)
5556
{
56-
const irep_idt &identifier=expr.get(ID_identifier);
57+
const irep_idt &identifier=to_symbol_expr(expr).get_identifier();
5758
let_valuest::const_iterator v_it=let_values.find(identifier);
5859
if(v_it!=let_values.end())
5960
check_acyclic(v_it->second, indent);
@@ -152,7 +153,7 @@ void mm2cppt::instruction2cpp(const codet &code, unsigned indent)
152153
assert(it->operands().size()==2);
153154
if(it->op0().id()==ID_symbol)
154155
{
155-
irep_idt identifier=it->op0().get(ID_identifier);
156+
irep_idt identifier=to_symbol_expr(it->op0()).get_identifier();
156157
let_values[identifier]=it->op1();
157158
}
158159
else

src/pointer-analysis/value_set_fivrns.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ void value_set_fivrnst::get_value_set_rec(
351351
{
352352
// just keep a reference to the ident in the set
353353
// (if it exists)
354-
irep_idt ident = expr.get_string(ID_identifier)+suffix;
354+
irep_idt ident = id2string(to_symbol_expr(expr).get_identifier())+suffix;
355355

356356
if(has_prefix(id2string(ident), alloc_adapter_prefix))
357357
{
@@ -1012,7 +1012,7 @@ void value_set_fivrnst::assign_rec(
10121012

10131013
if(lhs.id()==ID_symbol)
10141014
{
1015-
const irep_idt &identifier=lhs.get(ID_identifier);
1015+
const irep_idt &identifier=to_symbol_expr(lhs).get_identifier();
10161016

10171017
if(has_prefix(id2string(identifier),
10181018
"value_set::dynamic_object") ||

0 commit comments

Comments
 (0)