@@ -67,29 +67,19 @@ static inline bool is_ptr_argument(const typet &type)
67
67
return type.id ()==ID_pointer;
68
68
}
69
69
70
- void string_abstraction (
71
- symbol_tablet &symbol_table,
72
- message_handlert &message_handler,
73
- goto_functionst &dest)
74
- {
75
- string_abstractiont string_abstraction (symbol_table, message_handler);
76
- string_abstraction (dest);
77
- }
78
-
79
70
void string_abstraction (
80
71
goto_modelt &goto_model,
81
72
message_handlert &message_handler)
82
73
{
83
- string_abstractiont{goto_model.symbol_table , message_handler}.apply (
84
- goto_model);
74
+ string_abstractiont{goto_model, message_handler}.apply ();
85
75
}
86
76
87
77
string_abstractiont::string_abstractiont (
88
- symbol_tablet &_symbol_table ,
78
+ goto_modelt &goto_model ,
89
79
message_handlert &_message_handler)
90
80
: sym_suffix(" #str$fcn" ),
91
- symbol_table(_symbol_table ),
92
- ns(_symbol_table ),
81
+ goto_model(goto_model ),
82
+ ns(goto_model.symbol_table ),
93
83
temporary_counter(0 ),
94
84
message_handler(_message_handler)
95
85
{
@@ -101,7 +91,13 @@ string_abstractiont::string_abstractiont(
101
91
s.components ()[2 ].set_pretty_name (" size" );
102
92
103
93
symbolt &struct_symbol = get_fresh_aux_symbol (
104
- s, " tag-" , " string_struct" , source_locationt{}, ID_C, ns, symbol_table);
94
+ s,
95
+ " tag-" ,
96
+ " string_struct" ,
97
+ source_locationt{},
98
+ ID_C,
99
+ ns,
100
+ goto_model.symbol_table );
105
101
struct_symbol.is_type = true ;
106
102
struct_symbol.is_lvalue = false ;
107
103
struct_symbol.is_state_var = false ;
@@ -129,13 +125,11 @@ typet string_abstractiont::build_type(whatt what)
129
125
return type;
130
126
}
131
127
132
- void string_abstractiont::apply (goto_modelt &goto_model )
128
+ void string_abstractiont::apply ()
133
129
{
134
- operator ()( goto_model.goto_functions ) ;
135
- }
130
+ goto_functionst &dest = goto_model.goto_functions ;
131
+ symbol_tablet &symbol_table = goto_model. symbol_table ;
136
132
137
- void string_abstractiont::operator ()(goto_functionst &dest)
138
- {
139
133
// iterate over all previously known symbols as the body of the loop modifies
140
134
// the symbol table and can thus invalidate iterators
141
135
for (auto &sym_name : symbol_table.sorted_symbol_names ())
@@ -184,7 +178,7 @@ void string_abstractiont::operator()(goto_functionst &dest)
184
178
}
185
179
}
186
180
187
- void string_abstractiont::operator () (goto_programt &dest)
181
+ void string_abstractiont::apply (goto_programt &dest)
188
182
{
189
183
abstract (dest);
190
184
@@ -238,7 +232,7 @@ code_typet::parametert string_abstractiont::add_parameter(
238
232
" #str" ,
239
233
fct_symbol.location ,
240
234
fct_symbol.mode ,
241
- symbol_table);
235
+ goto_model. symbol_table );
242
236
param_symbol.is_parameter = true ;
243
237
param_symbol.value .make_nil ();
244
238
@@ -462,7 +456,7 @@ symbol_exprt string_abstractiont::add_dummy_symbol_and_value(
462
456
ref_instr->source_location ();
463
457
}
464
458
465
- symbol_table.insert (std::move (new_symbol));
459
+ goto_model. symbol_table .insert (std::move (new_symbol));
466
460
467
461
return sym_expr;
468
462
}
@@ -767,7 +761,7 @@ const typet &string_abstractiont::build_abstraction_type_rec(const typet &type,
767
761
existing_tag_symbol.location ,
768
762
existing_tag_symbol.mode ,
769
763
ns,
770
- symbol_table);
764
+ goto_model. symbol_table );
771
765
abstracted_type_symbol.is_type = true ;
772
766
abstracted_type_symbol.is_lvalue = false ;
773
767
abstracted_type_symbol.is_state_var = false ;
@@ -988,7 +982,7 @@ exprt string_abstractiont::build_unknown(const typet &type, bool write)
988
982
new_symbol.mode =ID_C;
989
983
new_symbol.pretty_name =identifier;
990
984
991
- symbol_table.insert (std::move (new_symbol));
985
+ goto_model. symbol_table .insert (std::move (new_symbol));
992
986
993
987
return ns.lookup (identifier).symbol_expr ();
994
988
}
@@ -1014,14 +1008,14 @@ bool string_abstractiont::build_symbol(const symbol_exprt &sym, exprt &dest)
1014
1008
std::string sym_suffix_before = sym_suffix;
1015
1009
sym_suffix = " #str" ;
1016
1010
identifier = id2string (symbol.name ) + sym_suffix;
1017
- if (symbol_table. symbols . find (identifier) == symbol_table.symbols . end ( ))
1011
+ if (!goto_model. symbol_table .has_symbol (identifier ))
1018
1012
build_new_symbol (symbol, identifier, abstract_type);
1019
1013
sym_suffix = sym_suffix_before;
1020
1014
}
1021
1015
else
1022
1016
{
1023
1017
identifier=id2string (symbol.name )+sym_suffix;
1024
- if (symbol_table. symbols . find (identifier)== symbol_table.symbols . end ( ))
1018
+ if (!goto_model. symbol_table .has_symbol (identifier ))
1025
1019
build_new_symbol (symbol, identifier, abstract_type);
1026
1020
}
1027
1021
@@ -1053,7 +1047,7 @@ void string_abstractiont::build_new_symbol(const symbolt &symbol,
1053
1047
new_symbol.is_static_lifetime =symbol.is_static_lifetime ;
1054
1048
new_symbol.is_thread_local =symbol.is_thread_local ;
1055
1049
1056
- symbol_table.insert (std::move (new_symbol));
1050
+ goto_model. symbol_table .insert (std::move (new_symbol));
1057
1051
1058
1052
if (symbol.is_static_lifetime )
1059
1053
{
@@ -1074,8 +1068,7 @@ bool string_abstractiont::build_symbol_constant(
1074
1068
+" _" +integer2string (buf_size);
1075
1069
irep_idt identifier=" string_abstraction::" +id2string (base);
1076
1070
1077
- if (symbol_table.symbols .find (identifier)==
1078
- symbol_table.symbols .end ())
1071
+ if (!goto_model.symbol_table .has_symbol (identifier))
1079
1072
{
1080
1073
auxiliary_symbolt new_symbol;
1081
1074
new_symbol.type =string_struct;
@@ -1100,7 +1093,7 @@ bool string_abstractiont::build_symbol_constant(
1100
1093
code_assignt (new_symbol.symbol_expr (), value)));
1101
1094
}
1102
1095
1103
- symbol_table.insert (std::move (new_symbol));
1096
+ goto_model. symbol_table .insert (std::move (new_symbol));
1104
1097
}
1105
1098
1106
1099
dest=address_of_exprt (symbol_exprt (identifier, string_struct));
0 commit comments