Skip to content

Commit 50f73c7

Browse files
author
Daniel Kroening
committed
type symbols now use ID_symbol_type
1 parent d24f773 commit 50f73c7

36 files changed

+73
-73
lines changed

src/analyses/invariant_propagation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ bool invariant_propagationt::check_type(const typet &type) const
189189
return false;
190190
else if(type.id()==ID_array)
191191
return false;
192-
else if(type.id()==ID_symbol)
192+
else if(type.id()==ID_symbol_type)
193193
return check_type(ns.follow(type));
194194
else if(type.id()==ID_unsignedbv ||
195195
type.id()==ID_signedbv)

src/analyses/uncaught_exceptions_analysis.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ irep_idt uncaught_exceptions_domaint::get_exception_type(const typet &type)
1919
{
2020
PRECONDITION(type.id()==ID_pointer);
2121

22-
if(type.subtype().id()==ID_symbol)
23-
{
22+
if(type.subtype().id()==ID_symbol_type)
2423
return to_symbol_type(type.subtype()).get_identifier();
25-
}
26-
return ID_empty;
24+
else
25+
return ID_empty;
2726
}
2827

2928
/// Returns the symbol corresponding to an exception

src/ansi-c/c_typecast.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,15 @@ bool check_c_implicit_typecast(
252252

253253
typet c_typecastt::follow_with_qualifiers(const typet &src_type)
254254
{
255-
if(src_type.id()!=ID_symbol)
255+
if(src_type.id()!=ID_symbol_type)
256256
return src_type;
257257

258258
typet result_type=src_type;
259259

260260
// collect qualifiers
261261
c_qualifierst qualifiers(src_type);
262262

263-
while(result_type.id()==ID_symbol)
263+
while(result_type.id()==ID_symbol_type)
264264
{
265265
const symbolt &followed_type_symbol =
266266
ns.lookup(to_symbol_type(result_type));
@@ -345,7 +345,7 @@ c_typecastt::c_typet c_typecastt::get_c_type(
345345
{
346346
return INT;
347347
}
348-
else if(type.id()==ID_symbol)
348+
else if(type.id()==ID_symbol_type)
349349
return get_c_type(ns.follow(type));
350350
else if(type.id()==ID_rational)
351351
return RATIONAL;

src/ansi-c/c_typecheck_base.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ void c_typecheck_baset::typecheck_redefinition_non_type(
404404
final_old.subtype()==final_new.subtype())
405405
{
406406
// we don't do symbol types for arrays anymore
407-
PRECONDITION(old_symbol.type.id()!=ID_symbol);
407+
PRECONDITION(old_symbol.type.id()!=ID_symbol_type);
408408
old_symbol.type=new_symbol.type;
409409
}
410410
else if((final_old.id()==ID_incomplete_c_enum ||

src/ansi-c/c_typecheck_code.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ bool c_typecheck_baset::is_complete_type(const typet &type) const
383383
}
384384
else if(type.id()==ID_vector)
385385
return is_complete_type(type.subtype());
386-
else if(type.id()==ID_symbol)
386+
else if(type.id()==ID_symbol_type)
387387
return is_complete_type(follow(type));
388388

389389
return true;

src/ansi-c/c_typecheck_expr.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ bool c_typecheck_baset::gcc_types_compatible_p(
8888
// read
8989
// http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/Other-Builtins.html
9090

91-
if(type1.id()==ID_symbol)
91+
if(type1.id()==ID_symbol_type)
9292
return gcc_types_compatible_p(follow(type1), type2);
93-
else if(type2.id()==ID_symbol)
93+
else if(type2.id()==ID_symbol_type)
9494
return gcc_types_compatible_p(type1, follow(type2));
9595

9696
// check qualifiers first
@@ -523,8 +523,8 @@ void c_typecheck_baset::typecheck_expr_builtin_offsetof(exprt &expr)
523523

524524
forall_operands(m_it, member)
525525
{
526-
if(type.id()==ID_symbol)
527-
type=follow(type);
526+
if(type.id()==ID_symbol_type)
527+
type=follow(to_symbol_type(type));
528528

529529
if(m_it->id()==ID_member)
530530
{
@@ -3032,8 +3032,8 @@ void c_typecheck_baset::typecheck_arithmetic_pointer(const exprt &expr)
30323032

30333033
typet subtype=type.subtype();
30343034

3035-
if(subtype.id()==ID_symbol)
3036-
subtype=follow(subtype);
3035+
if(subtype.id()==ID_symbol_type)
3036+
subtype=follow(to_symbol_type(subtype));
30373037

30383038
if(subtype.id()==ID_incomplete_struct)
30393039
{

src/ansi-c/expr2c.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ std::string expr2ct::convert_rec(
457457
return convert_rec(
458458
src.subtype(), qualifiers, declarator+"[]");
459459
}
460-
else if(src.id()==ID_symbol)
460+
else if(src.id()==ID_symbol_type)
461461
{
462462
symbol_typet symbolic_type=to_symbol_type(src);
463463
const irep_idt &typedef_identifer=symbolic_type.get(ID_typedef);

src/ansi-c/padding.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ mp_integer alignment(const typet &type, const namespacet &ns)
8282
result=alignment(type.subtype(), ns);
8383
else if(type.id()==ID_c_enum_tag)
8484
result=alignment(ns.follow_tag(to_c_enum_tag_type(type)), ns);
85-
else if(type.id()==ID_symbol)
86-
result=alignment(ns.follow(type), ns);
85+
else if(type.id()==ID_symbol_type)
86+
result=alignment(ns.follow(to_symbol_type(type)), ns);
8787
else if(type.id()==ID_c_bit_field)
8888
{
8989
// we align these according to the 'underlying type'

src/ansi-c/type2name.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static std::string type2name(
187187
else
188188
result+="ARR"+integer2string(size);
189189
}
190-
else if(type.id()==ID_symbol ||
190+
else if(type.id()==ID_symbol_type ||
191191
type.id()==ID_c_enum_tag ||
192192
type.id()==ID_struct_tag ||
193193
type.id()==ID_union_tag)

src/cpp/cpp_convert_type.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ void cpp_convert_plain_type(typet &type)
574574
type.id()==ID_bool ||
575575
type.id()==ID_floatbv ||
576576
type.id()==ID_empty ||
577-
type.id()==ID_symbol ||
577+
type.id()==ID_symbol_type ||
578578
type.id()==ID_constructor ||
579579
type.id()==ID_destructor)
580580
{

src/cpp/cpp_instantiate_template.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ std::string cpp_typecheckt::template_suffix(
4646
if(expr.id()==ID_type)
4747
{
4848
const typet &type=expr.type();
49-
if(type.id()==ID_symbol)
50-
result+=type.get_string(ID_identifier);
49+
if(type.id()==ID_symbol_type)
50+
result+=id2string(to_symbol_type(type).get_identifier());
5151
else
5252
result+=cpp_type2name(type);
5353
}
@@ -186,7 +186,7 @@ const symbolt &cpp_typecheckt::class_template_symbol(
186186
void cpp_typecheckt::elaborate_class_template(
187187
const typet &type)
188188
{
189-
if(type.id()!=ID_symbol)
189+
if(type.id()!=ID_symbol_type)
190190
return;
191191

192192
const symbolt &symbol = lookup(to_symbol_type(type));

src/cpp/cpp_typecheck_resolve.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void cpp_typecheck_resolvet::remove_duplicates(
171171

172172
if(it->id()==ID_symbol)
173173
id = to_symbol_expr(*it).get_identifier();
174-
else if(it->id()==ID_type && it->type().id()==ID_symbol)
174+
else if(it->id()==ID_type && it->type().id()==ID_symbol_type)
175175
id = to_symbol_type(it->type()).get_identifier();
176176

177177
if(id=="")
@@ -350,7 +350,7 @@ exprt cpp_typecheck_resolvet::convert_identifier(
350350
typet followed_type=symbol.type;
351351
bool constant=followed_type.get_bool(ID_C_constant);
352352

353-
while(followed_type.id()==ID_symbol)
353+
while(followed_type.id()==ID_symbol_type)
354354
{
355355
followed_type =
356356
cpp_typecheck.follow(to_symbol_type(followed_type));
@@ -2238,7 +2238,8 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
22382238
assert(pcomp.get_bool(ID_is_type));
22392239
const typet &type=pcomp.type();
22402240
assert(type.id()!=ID_struct);
2241-
if(type.id()==ID_symbol)
2241+
2242+
if(type.id()==ID_symbol_type)
22422243
identifier = to_symbol_type(type).get_identifier();
22432244
else
22442245
continue;
@@ -2260,7 +2261,7 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
22602261
new_set.insert(&class_id);
22612262
break;
22622263
}
2263-
else if(symbol.type.id()==ID_symbol)
2264+
else if(symbol.type.id()==ID_symbol_type)
22642265
identifier = to_symbol_type(symbol.type).get_identifier();
22652266
else
22662267
break;
@@ -2303,7 +2304,7 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
23032304
if(e.id()!=ID_type)
23042305
continue; // expressions are definitively not a scope
23052306

2306-
if(e.type().id()==ID_symbol)
2307+
if(e.type().id()==ID_symbol_type)
23072308
{
23082309
symbol_typet type=to_symbol_type(e.type());
23092310

@@ -2314,7 +2315,7 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
23142315
const symbolt &symbol=cpp_typecheck.lookup(identifier);
23152316
assert(symbol.is_type);
23162317

2317-
if(symbol.type.id()==ID_symbol)
2318+
if(symbol.type.id()==ID_symbol_type)
23182319
type=to_symbol_type(symbol.type);
23192320
else if(symbol.type.id()==ID_struct ||
23202321
symbol.type.id()==ID_incomplete_struct ||

src/cpp/cpp_typecheck_template.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,7 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
793793
// is it a type or not?
794794
if(declaration.get_bool(ID_is_type))
795795
{
796-
parameter=exprt(ID_type, typet(ID_symbol));
797-
parameter.type().set(ID_identifier, identifier);
796+
parameter=exprt(ID_type, symbol_typet(identifier));
798797
parameter.type().add_source_location()=declaration.find_source_location();
799798
}
800799
else
@@ -829,8 +828,7 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
829828
830829
if(cpp_declarator_converter.is_typedef)
831830
{
832-
parameter=exprt(ID_type, typet(ID_symbol));
833-
parameter.type().set(ID_identifier, symbol.name);
831+
parameter=exprt(ID_type, symbol_typet(symbol.name));
834832
parameter.type().add_source_location()=declaration.find_location();
835833
}
836834
else

src/cpp/template_map.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void template_mapt::apply(typet &type) const
3939
apply(subtype);
4040
}
4141
}
42-
else if(type.id()==ID_symbol)
42+
else if(type.id()==ID_symbol_type)
4343
{
4444
type_mapt::const_iterator m_it =
4545
type_map.find(to_symbol_type(type).get_identifier());

src/goto-instrument/dump_c.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void dump_ct::operator()(std::ostream &os)
6161
{
6262
typet &type=it2->type();
6363

64-
if(type.id()==ID_symbol &&
64+
if(type.id()==ID_symbol_type &&
6565
type.get_bool(ID_C_transparent_union))
6666
{
6767
symbolt new_type_sym=
@@ -314,7 +314,7 @@ void dump_ct::convert_compound(
314314
bool recursive,
315315
std::ostream &os)
316316
{
317-
if(type.id()==ID_symbol)
317+
if(type.id()==ID_symbol_type)
318318
{
319319
const symbolt &symbol=
320320
ns.lookup(to_symbol_type(type).get_identifier());
@@ -382,7 +382,7 @@ void dump_ct::convert_compound(
382382
UNREACHABLE;
383383
/*
384384
assert(parent_it->id() == ID_base);
385-
assert(parent_it->get(ID_type) == ID_symbol);
385+
assert(parent_it->get(ID_type) == ID_symbol_type);
386386
387387
const irep_idt &base_id=
388388
parent_it->find(ID_type).get(ID_identifier);
@@ -669,7 +669,7 @@ void dump_ct::collect_typedefs_rec(
669669
{
670670
collect_typedefs_rec(type.subtype(), early, local_deps);
671671
}
672-
else if(type.id()==ID_symbol)
672+
else if(type.id()==ID_symbol_type)
673673
{
674674
const symbolt &symbol=
675675
ns.lookup(to_symbol_type(type).get_identifier());

src/goto-instrument/goto_program2code.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ goto_programt::const_targett goto_program2codet::convert_catch(
14291429

14301430
void goto_program2codet::add_local_types(const typet &type)
14311431
{
1432-
if(type.id()==ID_symbol)
1432+
if(type.id()==ID_symbol_type)
14331433
{
14341434
const typet &full_type=ns.follow(type);
14351435

@@ -1662,7 +1662,7 @@ void goto_program2codet::remove_const(typet &type)
16621662
if(type.get_bool(ID_C_constant))
16631663
type.remove(ID_C_constant);
16641664

1665-
if(type.id()==ID_symbol)
1665+
if(type.id()==ID_symbol_type)
16661666
{
16671667
const irep_idt &identifier=to_symbol_type(type).get_identifier();
16681668
if(!const_removed.insert(identifier).second)
@@ -1864,7 +1864,7 @@ void goto_program2codet::cleanup_expr(exprt &expr, bool no_typecast)
18641864
if(no_typecast)
18651865
return;
18661866

1867-
assert(expr.type().id()==ID_symbol);
1867+
assert(expr.type().id()==ID_symbol_type);
18681868

18691869
const typet &t=expr.type();
18701870

src/goto-programs/destructor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ code_function_callt get_destructor(
1919
const namespacet &ns,
2020
const typet &type)
2121
{
22-
if(type.id()==ID_symbol)
22+
if(type.id()==ID_symbol_type)
2323
{
2424
return get_destructor(ns, ns.follow(type));
2525
}

src/goto-programs/interpreter.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,11 @@ mp_integer interpretert::get_size(const typet &type)
10411041
}
10421042
return subtype_size;
10431043
}
1044-
else if(type.id()==ID_symbol)
1044+
else if(type.id()==ID_symbol_type)
10451045
{
10461046
return get_size(ns.follow(type));
10471047
}
1048+
10481049
return 1;
10491050
}
10501051

src/goto-programs/string_abstraction.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class string_abstractiont:public messaget
5252

5353
bool is_char_type(const typet &type) const
5454
{
55-
if(type.id()==ID_symbol)
55+
if(type.id()==ID_symbol_type)
5656
return is_char_type(ns.follow(type));
5757

5858
if(type.id()!=ID_signedbv &&

src/goto-symex/goto_symex_state.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ void goto_symex_statet::rename_address(
755755

756756
// type might not have been renamed in case of nesting of
757757
// structs and pointers/arrays
758-
if(member_expr.struct_op().type().id()!=ID_symbol)
758+
if(member_expr.struct_op().type().id()!=ID_symbol_type)
759759
{
760760
const struct_union_typet &su_type=
761761
to_struct_union_type(member_expr.struct_op().type());
@@ -838,7 +838,7 @@ void goto_symex_statet::rename(
838838
{
839839
rename(type.subtype(), irep_idt(), ns, level);
840840
}
841-
else if(type.id()==ID_symbol)
841+
else if(type.id()==ID_symbol_type)
842842
{
843843
const symbolt &symbol=
844844
ns.lookup(to_symbol_type(type).get_identifier());

src/linking/linking.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static const typet &follow_tags_symbols(
4444
const namespacet &ns,
4545
const typet &type)
4646
{
47-
if(type.id()==ID_symbol)
47+
if(type.id()==ID_symbol_type)
4848
return ns.follow(type);
4949
else if(type.id()==ID_c_enum_tag)
5050
return ns.follow_tag(to_c_enum_tag_type(type));
@@ -779,7 +779,7 @@ bool linkingt::adjust_object_type_rec(
779779
if(base_type_eq(t1, t2, ns))
780780
return false;
781781

782-
if(t1.id()==ID_symbol ||
782+
if(t1.id()==ID_symbol_type ||
783783
t1.id()==ID_struct_tag ||
784784
t1.id()==ID_union_tag ||
785785
t1.id()==ID_c_enum_tag)
@@ -797,7 +797,7 @@ bool linkingt::adjust_object_type_rec(
797797

798798
return false;
799799
}
800-
else if(t2.id()==ID_symbol ||
800+
else if(t2.id()==ID_symbol_type ||
801801
t2.id()==ID_struct_tag ||
802802
t2.id()==ID_union_tag ||
803803
t2.id()==ID_c_enum_tag)

src/linking/zero_initializer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ exprt zero_initializert::zero_initializer_rec(
262262

263263
return value;
264264
}
265-
else if(type_id==ID_symbol)
265+
else if(type_id==ID_symbol_type)
266266
{
267267
exprt result=zero_initializer_rec(ns.follow(type), source_location);
268268
// we might have mangled the type for arrays, so keep that

0 commit comments

Comments
 (0)