Skip to content

Commit ae4fe25

Browse files
author
Daniel Kroening
committed
type symbols now use ID_symbol_type
1 parent 1700b60 commit ae4fe25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+128
-122
lines changed

jbmc/src/java_bytecode/ci_lazy_methods.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ void ci_lazy_methodst::gather_field_types(
628628
{
629629
// If class_type is not a symbol this may be a reference array,
630630
// but we can't tell what type.
631-
if(class_type.id() == ID_symbol)
631+
if(class_type.id() == ID_symbol_type)
632632
{
633633
const typet &element_type =
634634
java_array_element_type(to_symbol_type(class_type));
@@ -644,11 +644,11 @@ void ci_lazy_methodst::gather_field_types(
644644
{
645645
for(const auto &field : underlying_type.components())
646646
{
647-
if(field.type().id() == ID_struct || field.type().id() == ID_symbol)
647+
if(field.type().id() == ID_struct || field.type().id() == ID_symbol_type)
648648
gather_field_types(field.type(), ns, needed_lazy_methods);
649649
else if(field.type().id() == ID_pointer)
650650
{
651-
if(field.type().subtype().id() == ID_symbol)
651+
if(field.type().subtype().id() == ID_symbol_type)
652652
{
653653
initialize_all_instantiated_classes_from_pointer(
654654
to_pointer_type(field.type()), ns, needed_lazy_methods);

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
16101610
const typecast_exprt pointer(op[0], java_array_type(statement[0]));
16111611

16121612
dereference_exprt array(pointer, pointer.type().subtype());
1613-
assert(pointer.type().subtype().id()==ID_symbol);
1613+
assert(pointer.type().subtype().id()==ID_symbol_type);
16141614
array.set(ID_java_member_access, true);
16151615

16161616
const member_exprt length(array, "length", java_int_type());
@@ -2553,7 +2553,7 @@ codet java_bytecode_convert_methodt::convert_putstatic(
25532553
const exprt::operandst &op,
25542554
const symbol_exprt &symbol_expr)
25552555
{
2556-
if(needed_lazy_methods && arg0.type().id() == ID_symbol)
2556+
if(needed_lazy_methods && arg0.type().id() == ID_symbol_type)
25572557
{
25582558
needed_lazy_methods->add_needed_class(
25592559
to_symbol_type(arg0.type()).get_identifier());
@@ -2603,15 +2603,15 @@ void java_bytecode_convert_methodt::convert_getstatic(
26032603
{
26042604
if(needed_lazy_methods)
26052605
{
2606-
if(arg0.type().id() == ID_symbol)
2606+
if(arg0.type().id() == ID_symbol_type)
26072607
{
26082608
needed_lazy_methods->add_needed_class(
26092609
to_symbol_type(arg0.type()).get_identifier());
26102610
}
26112611
else if(arg0.type().id() == ID_pointer)
26122612
{
26132613
const auto &pointer_type = to_pointer_type(arg0.type());
2614-
if(pointer_type.subtype().id() == ID_symbol)
2614+
if(pointer_type.subtype().id() == ID_symbol_type)
26152615
{
26162616
needed_lazy_methods->add_needed_class(
26172617
to_symbol_type(pointer_type.subtype()).get_identifier());

jbmc/src/java_bytecode/java_bytecode_parse_tree.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ java_bytecode_parse_treet::find_annotation(
117117
if(annotation.type.id() != ID_pointer)
118118
return false;
119119
const typet &type = annotation.type.subtype();
120-
return type.id() == ID_symbol &&
120+
return type.id() == ID_symbol_type &&
121121
to_symbol_type(type).get_identifier() == annotation_type_name;
122122
});
123123
if(annotation_it == annotations.end())

jbmc/src/java_bytecode/java_bytecode_typecheck_type.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Author: Daniel Kroening, [email protected]
1616

1717
void java_bytecode_typecheckt::typecheck_type(typet &type)
1818
{
19-
if(type.id()==ID_symbol)
19+
if(type.id()==ID_symbol_type)
2020
{
2121
irep_idt identifier=to_symbol_type(type).get_identifier();
2222

jbmc/src/java_bytecode/java_object_factory.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ void java_object_factoryt::gen_nondet_init(
12011201
if(is_sub)
12021202
{
12031203
const typet &symbol = override_ ? override_type : expr.type();
1204-
PRECONDITION(symbol.id() == ID_symbol);
1204+
PRECONDITION(symbol.id() == ID_symbol_type);
12051205
generic_parameter_specialization_map_keys.insert_pairs_for_symbol(
12061206
to_symbol_type(symbol), struct_type);
12071207
}
@@ -1305,7 +1305,7 @@ void java_object_factoryt::gen_nondet_array_init(
13051305
update_in_placet update_in_place)
13061306
{
13071307
PRECONDITION(expr.type().id()==ID_pointer);
1308-
PRECONDITION(expr.type().subtype().id()==ID_symbol);
1308+
PRECONDITION(expr.type().subtype().id()==ID_symbol_type);
13091309
PRECONDITION(update_in_place!=update_in_placet::MAY_UPDATE_IN_PLACE);
13101310

13111311
const typet &type=ns.follow(expr.type().subtype());

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Date: April 2017
3636
irep_idt get_tag(const typet &type)
3737
{
3838
/// \todo Use follow instead of assuming tag to symbol relationship.
39-
if(type.id() == ID_symbol)
39+
if(type.id() == ID_symbol_type)
4040
return to_symbol_type(type).get_identifier();
4141
else if(type.id() == ID_struct)
4242
return irep_idt("java::" + id2string(to_struct_type(type).get_tag()));
@@ -393,11 +393,11 @@ java_string_library_preprocesst::process_equals_function_operands(
393393
/// \return type of the "data" component
394394
static typet get_data_type(const typet &type, const symbol_tablet &symbol_table)
395395
{
396-
PRECONDITION(type.id()==ID_struct || type.id()==ID_symbol);
397-
if(type.id()==ID_symbol)
396+
PRECONDITION(type.id()==ID_struct || type.id()==ID_symbol_type);
397+
if(type.id()==ID_symbol_type)
398398
{
399399
symbolt sym=*symbol_table.lookup(to_symbol_type(type).get_identifier());
400-
CHECK_RETURN(sym.type.id()!=ID_symbol);
400+
CHECK_RETURN(sym.type.id()!=ID_symbol_type);
401401
return get_data_type(sym.type, symbol_table);
402402
}
403403
// else type id is ID_struct
@@ -412,11 +412,11 @@ static typet get_data_type(const typet &type, const symbol_tablet &symbol_table)
412412
static typet
413413
get_length_type(const typet &type, const symbol_tablet &symbol_table)
414414
{
415-
PRECONDITION(type.id()==ID_struct || type.id()==ID_symbol);
416-
if(type.id()==ID_symbol)
415+
PRECONDITION(type.id()==ID_struct || type.id()==ID_symbol_type);
416+
if(type.id()==ID_symbol_type)
417417
{
418418
symbolt sym=*symbol_table.lookup(to_symbol_type(type).get_identifier());
419-
CHECK_RETURN(sym.type.id()!=ID_symbol);
419+
CHECK_RETURN(sym.type.id()!=ID_symbol_type);
420420
return get_length_type(sym.type, symbol_table);
421421
}
422422
// else type id is ID_struct
@@ -891,7 +891,7 @@ void java_string_library_preprocesst::code_assign_java_string_to_string_expr(
891891
PRECONDITION(implements_java_char_sequence_pointer(rhs.type()));
892892

893893
typet deref_type;
894-
if(rhs.type().subtype().id()==ID_symbol)
894+
if(rhs.type().subtype().id()==ID_symbol_type)
895895
deref_type=symbol_table.lookup_ref(
896896
to_symbol_type(rhs.type().subtype()).get_identifier()).type;
897897
else

jbmc/src/java_bytecode/java_types.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ bool equal_java_types(const typet &type1, const typet &type2)
735735
bool arrays_with_same_element_type = true;
736736
if(
737737
type1.id() == ID_pointer && type2.id() == ID_pointer &&
738-
type1.subtype().id() == ID_symbol && type2.subtype().id() == ID_symbol)
738+
type1.subtype().id() == ID_symbol_type && type2.subtype().id() == ID_symbol_type)
739739
{
740740
const symbol_typet &subtype_symbol1 = to_symbol_type(type1.subtype());
741741
const symbol_typet &subtype_symbol2 = to_symbol_type(type2.subtype());
@@ -782,7 +782,7 @@ void get_dependencies_from_generic_parameters_rec(
782782
}
783783

784784
// symbol type
785-
else if(t.id() == ID_symbol)
785+
else if(t.id() == ID_symbol_type)
786786
{
787787
const symbol_typet &symbol_type = to_symbol_type(t);
788788
const irep_idt class_name(symbol_type.get_identifier());
@@ -916,7 +916,7 @@ std::string pretty_java_type(const typet &type)
916916
return "byte";
917917
else if(is_reference(type))
918918
{
919-
if(type.subtype().id() == ID_symbol)
919+
if(type.subtype().id() == ID_symbol_type)
920920
{
921921
const auto &symbol_type = to_symbol_type(type.subtype());
922922
const irep_idt &id = symbol_type.get_identifier();

jbmc/src/java_bytecode/remove_instanceof.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ std::size_t remove_instanceoft::lower_instanceof(
8080

8181
// Find all types we know about that satisfy the given requirement:
8282
INVARIANT(
83-
target_type.id()==ID_symbol,
83+
target_type.id()==ID_symbol_type,
8484
"instanceof second operand should have a simple type");
8585
const irep_idt &target_name=
8686
to_symbol_type(target_type).get_identifier();

jbmc/src/java_bytecode/select_pointer_type.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pointer_typet select_pointer_typet::specialize_generics(
107107
visited_nodes.erase(parameter_name);
108108
return returned_type;
109109
}
110-
else if(pointer_type.subtype().id() == ID_symbol)
110+
else if(pointer_type.subtype().id() == ID_symbol_type)
111111
{
112112
// if the pointer is an array, recursively specialize its element type
113113
const symbol_typet &array_subtype = to_symbol_type(pointer_type.subtype());

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/ansi_c_declaration.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ void ansi_c_declaratort::build(irept &src)
2222
{
2323
typet *p=static_cast<typet *>(&src);
2424

25-
// walk down subtype until we hit symbol or "abstract"
25+
// walk down subtype until we hit symbol_type or "abstract"
2626
while(true)
2727
{
2828
typet &t=*p;
2929

30-
if(t.id()==ID_symbol)
30+
if(t.id()==ID_symbol_type ||
31+
t.id()==ID_symbol)
3132
{
3233
set_base_name(t.get(ID_C_base_name));
3334
add_source_location()=t.source_location();

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
@@ -384,7 +384,7 @@ bool c_typecheck_baset::is_complete_type(const typet &type) const
384384
}
385385
else if(type.id()==ID_vector)
386386
return is_complete_type(type.subtype());
387-
else if(type.id()==ID_symbol)
387+
else if(type.id()==ID_symbol_type)
388388
return is_complete_type(follow(type));
389389

390390
return true;

src/ansi-c/c_typecheck_expr.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ bool c_typecheck_baset::gcc_types_compatible_p(
9191
// read
9292
// http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/Other-Builtins.html
9393

94-
if(type1.id()==ID_symbol)
94+
if(type1.id()==ID_symbol_type)
9595
return gcc_types_compatible_p(follow(type1), type2);
96-
else if(type2.id()==ID_symbol)
96+
else if(type2.id()==ID_symbol_type)
9797
return gcc_types_compatible_p(type1, follow(type2));
9898

9999
// check qualifiers first
@@ -524,8 +524,8 @@ void c_typecheck_baset::typecheck_expr_builtin_offsetof(exprt &expr)
524524

525525
forall_operands(m_it, member)
526526
{
527-
if(type.id()==ID_symbol)
528-
type=follow(type);
527+
if(type.id()==ID_symbol_type)
528+
type=follow(to_symbol_type(type));
529529

530530
if(m_it->id()==ID_member)
531531
{
@@ -3133,8 +3133,8 @@ void c_typecheck_baset::typecheck_arithmetic_pointer(const exprt &expr)
31333133

31343134
typet subtype=type.subtype();
31353135

3136-
if(subtype.id()==ID_symbol)
3137-
subtype=follow(subtype);
3136+
if(subtype.id()==ID_symbol_type)
3137+
subtype=follow(to_symbol_type(subtype));
31383138

31393139
if(subtype.id()==ID_incomplete_struct)
31403140
{

src/ansi-c/c_typecheck_initializer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ exprt::operandst::const_iterator c_typecheck_baset::do_designated_initializer(
492492

493493
const typet &type=designator.back().subtype;
494494
const typet &full_type=follow(type);
495-
assert(full_type.id()!=ID_symbol);
495+
assert(full_type.id()!=ID_symbol_type);
496496

497497
// do we initialize a scalar?
498498
if(full_type.id()!=ID_struct &&

src/ansi-c/c_typecheck_type.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void c_typecheck_baset::typecheck_type(typet &type)
8888
typecheck_c_bit_field_type(to_c_bit_field_type(type));
8989
else if(type.id()==ID_typeof)
9090
typecheck_typeof_type(type);
91-
else if(type.id()==ID_symbol)
91+
else if(type.id()==ID_symbol_type)
9292
typecheck_symbol_type(type);
9393
else if(type.id()==ID_vector)
9494
typecheck_vector_type(to_vector_type(type));

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/scanner.l

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,20 @@ int make_identifier()
9292

9393
PARSER.tag_following=false;
9494

95-
stack(yyansi_clval).id(ID_symbol);
9695
stack(yyansi_clval).set(ID_C_base_name, base_name);
9796
stack(yyansi_clval).set(ID_identifier, identifier);
9897
stack(yyansi_clval).set(ID_C_id_class, static_cast<int>(result));
9998

10099
if(result==ansi_c_id_classt::ANSI_C_TYPEDEF)
100+
{
101+
stack(yyansi_clval).id(ID_symbol_type);
101102
return TOK_TYPEDEFNAME;
103+
}
102104
else
105+
{
106+
stack(yyansi_clval).id(ID_symbol);
103107
return TOK_IDENTIFIER;
108+
}
104109
}
105110
}
106111

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
@@ -578,7 +578,7 @@ void cpp_convert_plain_type(typet &type)
578578
type.id()==ID_bool ||
579579
type.id()==ID_floatbv ||
580580
type.id()==ID_empty ||
581-
type.id()==ID_symbol ||
581+
type.id()==ID_symbol_type ||
582582
type.id()==ID_constructor ||
583583
type.id()==ID_destructor)
584584
{

src/cpp/cpp_declarator_converter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ symbolt &cpp_declarator_convertert::convert(
142142
cpp_typecheck_fargst());
143143

144144
if(symbol_expr.id()!=ID_type ||
145-
symbol_expr.type().id()!=ID_symbol)
145+
symbol_expr.type().id()!=ID_symbol_type)
146146
{
147147
cpp_typecheck.error().source_location=name.source_location();
148148
cpp_typecheck.error() << "error: expected type"

0 commit comments

Comments
 (0)