Skip to content

Commit 25c097e

Browse files
author
Daniel Kroening
committed
use get_identifier() instead of get(ID_identifier) on symbols
1 parent 70f13f3 commit 25c097e

30 files changed

+161
-99
lines changed

src/analyses/ai.cpp

Lines changed: 1 addition & 1 deletion
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/analyses/flow_insensitive_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ bool flow_insensitive_analysis_baset::do_function_call_rec(
293293

294294
if(function.id()==ID_symbol)
295295
{
296-
const irep_idt &identifier=function.get(ID_identifier);
296+
const irep_idt &identifier = to_symbol_expr(function).get_identifier();
297297

298298
if(recursion_set.find(identifier)!=recursion_set.end())
299299
{

src/analyses/invariant_set.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ std::string inv_object_storet::build_string(const exprt &expr) const
143143
}
144144

145145
if(expr.id()==ID_symbol)
146-
return expr.get_string(ID_identifier);
146+
return id2string(to_symbol_expr(expr).get_identifier());
147147

148148
return "";
149149
}

src/analyses/static_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void static_analysis_baset::do_function_call_rec(
328328

329329
if(function.id()==ID_symbol)
330330
{
331-
const irep_idt &identifier=function.get(ID_identifier);
331+
const irep_idt &identifier = to_symbol_expr(function).get_identifier();
332332

333333
if(recursion_set.find(identifier)!=recursion_set.end())
334334
{

src/ansi-c/c_typecast.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ typet c_typecastt::follow_with_qualifiers(const typet &src_type)
262262

263263
while(result_type.id()==ID_symbol)
264264
{
265-
const symbolt &followed_type_symbol=
266-
ns.lookup(result_type.get(ID_identifier));
265+
const symbolt &followed_type_symbol =
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/type2name.cpp

Lines changed: 2 additions & 1 deletion
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

@@ -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

src/cpp/cpp_is_pod.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ bool cpp_typecheckt::cpp_is_pod(const typet &type) const
8282
}
8383
else if(type.id()==ID_symbol)
8484
{
85-
const symbolt &symb=lookup(type.get(ID_identifier));
86-
assert(symb.is_type);
85+
const symbolt &symb = lookup(to_symbol_type(type));
86+
DATA_INVARIANT(symb.is_type, "type symbol is a type");
8787
return cpp_is_pod(symb.type);
8888
}
8989

src/cpp/cpp_typecheck_resolve.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ void cpp_typecheck_resolvet::remove_duplicates(
170170
irep_idt id;
171171

172172
if(it->id()==ID_symbol)
173-
id=it->get(ID_identifier);
173+
id = to_symbol_expr(*it).get_identifier();
174174
else if(it->id()==ID_type && it->type().id()==ID_symbol)
175-
id=it->type().get(ID_identifier);
175+
id = to_symbol_type(it->type()).get_identifier();
176176

177177
if(id=="")
178178
{
@@ -2041,8 +2041,8 @@ void cpp_typecheck_resolvet::apply_template_args(
20412041
if(expr.id()!=ID_symbol)
20422042
return; // templates are always symbols
20432043

2044-
const symbolt &template_symbol=
2045-
cpp_typecheck.lookup(expr.get(ID_identifier));
2044+
const symbolt &template_symbol =
2045+
cpp_typecheck.lookup(to_symbol_expr(expr).get_identifier());
20462046

20472047
if(!template_symbol.type.get_bool(ID_is_template))
20482048
return;
@@ -2239,7 +2239,7 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
22392239
const typet &type=pcomp.type();
22402240
assert(type.id()!=ID_struct);
22412241
if(type.id()==ID_symbol)
2242-
identifier=type.get(ID_identifier);
2242+
identifier = to_symbol_type(type).get_identifier();
22432243
else
22442244
continue;
22452245
}
@@ -2261,7 +2261,7 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
22612261
break;
22622262
}
22632263
else if(symbol.type.id()==ID_symbol)
2264-
identifier=symbol.type.get(ID_identifier);
2264+
identifier = to_symbol_type(symbol.type).get_identifier();
22652265
else
22662266
break;
22672267
}

src/cpp/template_map.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Author: Daniel Kroening, [email protected]
1414
#include <ostream>
1515

1616
#include <util/invariant.h>
17+
#include <util/std_expr.h>
18+
#include <util/std_types.h>
1719

1820
void template_mapt::apply(typet &type) const
1921
{
@@ -39,8 +41,8 @@ void template_mapt::apply(typet &type) const
3941
}
4042
else if(type.id()==ID_symbol)
4143
{
42-
type_mapt::const_iterator m_it=
43-
type_map.find(type.get(ID_identifier));
44+
type_mapt::const_iterator m_it =
45+
type_map.find(to_symbol_type(type).get_identifier());
4446

4547
if(m_it!=type_map.end())
4648
{
@@ -73,8 +75,8 @@ void template_mapt::apply(exprt &expr) const
7375

7476
if(expr.id()==ID_symbol)
7577
{
76-
expr_mapt::const_iterator m_it=
77-
expr_map.find(expr.get(ID_identifier));
78+
expr_mapt::const_iterator m_it =
79+
expr_map.find(to_symbol_expr(expr).get_identifier());
7880

7981
if(m_it!=expr_map.end())
8082
{

src/goto-programs/builtin_functions.cpp

Lines changed: 11 additions & 11 deletions
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
{

0 commit comments

Comments
 (0)