Skip to content

Commit 599ae2c

Browse files
author
Daniel Kroening
committed
type symbols now use ID_symbol_type
1 parent 6e554d9 commit 599ae2c

Some content is hidden

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

61 files changed

+157
-162
lines changed

jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void ci_lazy_methods_neededt::gather_field_types(
112112
{
113113
// If class_type is not a symbol this may be a reference array,
114114
// but we can't tell what type.
115-
if(class_type.id() == ID_symbol)
115+
if(class_type.id() == ID_symbol_type)
116116
{
117117
const typet &element_type =
118118
java_array_element_type(to_symbol_type(class_type));
@@ -127,11 +127,11 @@ void ci_lazy_methods_neededt::gather_field_types(
127127
{
128128
for(const auto &field : underlying_type.components())
129129
{
130-
if(field.type().id() == ID_struct || field.type().id() == ID_symbol)
130+
if(field.type().id() == ID_struct || field.type().id() == ID_symbol_type)
131131
gather_field_types(field.type(), ns);
132132
else if(field.type().id() == ID_pointer)
133133
{
134-
if(field.type().subtype().id() == ID_symbol)
134+
if(field.type().subtype().id() == ID_symbol_type)
135135
{
136136
add_all_needed_classes(to_pointer_type(field.type()));
137137
}

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

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

16331633
dereference_exprt array(pointer, pointer.type().subtype());
1634-
assert(pointer.type().subtype().id()==ID_symbol);
1634+
assert(pointer.type().subtype().id() == ID_symbol_type);
16351635
array.set(ID_java_member_access, true);
16361636

16371637
const member_exprt length(array, "length", java_int_type());
@@ -2564,7 +2564,7 @@ codet java_bytecode_convert_methodt::convert_putstatic(
25642564
const exprt::operandst &op,
25652565
const symbol_exprt &symbol_expr)
25662566
{
2567-
if(needed_lazy_methods && arg0.type().id() == ID_symbol)
2567+
if(needed_lazy_methods && arg0.type().id() == ID_symbol_type)
25682568
{
25692569
needed_lazy_methods->add_needed_class(
25702570
to_symbol_type(arg0.type()).get_identifier());
@@ -2614,15 +2614,15 @@ void java_bytecode_convert_methodt::convert_getstatic(
26142614
{
26152615
if(needed_lazy_methods)
26162616
{
2617-
if(arg0.type().id() == ID_symbol)
2617+
if(arg0.type().id() == ID_symbol_type)
26182618
{
26192619
needed_lazy_methods->add_needed_class(
26202620
to_symbol_type(arg0.type()).get_identifier());
26212621
}
26222622
else if(arg0.type().id() == ID_pointer)
26232623
{
26242624
const auto &pointer_type = to_pointer_type(arg0.type());
2625-
if(pointer_type.subtype().id() == ID_symbol)
2625+
if(pointer_type.subtype().id() == ID_symbol_type)
26262626
{
26272627
needed_lazy_methods->add_needed_class(
26282628
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
@@ -1168,7 +1168,7 @@ void java_object_factoryt::gen_nondet_init(
11681168
if(is_sub)
11691169
{
11701170
const typet &symbol = override_ ? override_type : expr.type();
1171-
PRECONDITION(symbol.id() == ID_symbol);
1171+
PRECONDITION(symbol.id() == ID_symbol_type);
11721172
generic_parameter_specialization_map_keys.insert_pairs_for_symbol(
11731173
to_symbol_type(symbol), struct_type);
11741174
}
@@ -1272,7 +1272,7 @@ void java_object_factoryt::gen_nondet_array_init(
12721272
update_in_placet update_in_place)
12731273
{
12741274
PRECONDITION(expr.type().id()==ID_pointer);
1275-
PRECONDITION(expr.type().subtype().id()==ID_symbol);
1275+
PRECONDITION(expr.type().subtype().id() == ID_symbol_type);
12761276
PRECONDITION(update_in_place!=update_in_placet::MAY_UPDATE_IN_PLACE);
12771277

12781278
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()));
@@ -394,11 +394,11 @@ java_string_library_preprocesst::process_equals_function_operands(
394394
/// \return type of the "data" component
395395
static typet get_data_type(const typet &type, const symbol_tablet &symbol_table)
396396
{
397-
PRECONDITION(type.id()==ID_struct || type.id()==ID_symbol);
398-
if(type.id()==ID_symbol)
397+
PRECONDITION(type.id() == ID_struct || type.id() == ID_symbol_type);
398+
if(type.id() == ID_symbol_type)
399399
{
400400
symbolt sym=*symbol_table.lookup(to_symbol_type(type).get_identifier());
401-
CHECK_RETURN(sym.type.id()!=ID_symbol);
401+
CHECK_RETURN(sym.type.id() != ID_symbol_type);
402402
return get_data_type(sym.type, symbol_table);
403403
}
404404
// else type id is ID_struct
@@ -413,11 +413,11 @@ static typet get_data_type(const typet &type, const symbol_tablet &symbol_table)
413413
static typet
414414
get_length_type(const typet &type, const symbol_tablet &symbol_table)
415415
{
416-
PRECONDITION(type.id()==ID_struct || type.id()==ID_symbol);
417-
if(type.id()==ID_symbol)
416+
PRECONDITION(type.id() == ID_struct || type.id() == ID_symbol_type);
417+
if(type.id() == ID_symbol_type)
418418
{
419419
symbolt sym=*symbol_table.lookup(to_symbol_type(type).get_identifier());
420-
CHECK_RETURN(sym.type.id()!=ID_symbol);
420+
CHECK_RETURN(sym.type.id() != ID_symbol_type);
421421
return get_length_type(sym.type, symbol_table);
422422
}
423423
// else type id is ID_struct
@@ -892,7 +892,7 @@ void java_string_library_preprocesst::code_assign_java_string_to_string_expr(
892892
PRECONDITION(implements_java_char_sequence_pointer(rhs.type()));
893893

894894
typet deref_type;
895-
if(rhs.type().subtype().id()==ID_symbol)
895+
if(rhs.type().subtype().id() == ID_symbol_type)
896896
deref_type=symbol_table.lookup_ref(
897897
to_symbol_type(rhs.type().subtype()).get_identifier()).type;
898898
else

jbmc/src/java_bytecode/java_types.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,8 @@ 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 &&
739+
type2.subtype().id() == ID_symbol_type)
739740
{
740741
const symbol_typet &subtype_symbol1 = to_symbol_type(type1.subtype());
741742
const symbol_typet &subtype_symbol2 = to_symbol_type(type2.subtype());
@@ -782,7 +783,7 @@ void get_dependencies_from_generic_parameters_rec(
782783
}
783784

784785
// symbol type
785-
else if(t.id() == ID_symbol)
786+
else if(t.id() == ID_symbol_type)
786787
{
787788
const symbol_typet &symbol_type = to_symbol_type(t);
788789
const irep_idt class_name(symbol_type.get_identifier());
@@ -916,7 +917,7 @@ std::string pretty_java_type(const typet &type)
916917
return "byte";
917918
else if(is_reference(type))
918919
{
919-
if(type.subtype().id() == ID_symbol)
920+
if(type.subtype().id() == ID_symbol_type)
920921
{
921922
const auto &symbol_type = to_symbol_type(type.subtype());
922923
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
@@ -85,7 +85,7 @@ bool remove_instanceoft::lower_instanceof(
8585

8686
// Find all types we know about that satisfy the given requirement:
8787
INVARIANT(
88-
target_type.id()==ID_symbol,
88+
target_type.id() == ID_symbol_type,
8989
"instanceof second operand should have a simple type");
9090
const irep_idt &target_name=
9191
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());

jbmc/unit/java-testing-utils/require_type.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ require_type::require_complete_java_non_generic_class(const typet &class_type)
425425
const symbol_typet &
426426
require_type::require_symbol(const typet &type, const irep_idt &identifier)
427427
{
428-
REQUIRE(type.id() == ID_symbol);
428+
REQUIRE(type.id() == ID_symbol_type);
429429
const symbol_typet &result = to_symbol_type(type);
430430
if(identifier != "")
431431
{

jbmc/unit/java_bytecode/goto_program_generics/mutually_recursive_generics.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ SCENARIO(
6363
next.type(),
6464
{{require_type::type_argument_kindt::Var, "java::KeyValue::K"},
6565
{require_type::type_argument_kindt::Var, "java::KeyValue::V"}});
66-
REQUIRE(next_type.subtype().id() == ID_symbol);
66+
REQUIRE(next_type.subtype().id() == ID_symbol_type);
6767
const symbol_typet &next_symbol = to_symbol_type(next_type.subtype());
6868
REQUIRE(
6969
symbol_table.lookup_ref(next_symbol.get_identifier()).name ==
@@ -75,7 +75,7 @@ SCENARIO(
7575
reverse.type(),
7676
{{require_type::type_argument_kindt::Var, "java::KeyValue::V"},
7777
{require_type::type_argument_kindt::Var, "java::KeyValue::K"}});
78-
REQUIRE(next_type.subtype().id() == ID_symbol);
78+
REQUIRE(next_type.subtype().id() == ID_symbol_type);
7979
const symbol_typet &reverse_symbol = to_symbol_type(reverse_type.subtype());
8080
REQUIRE(
8181
symbol_table.lookup_ref(next_symbol.get_identifier()).name ==

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ 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 || t.id() == ID_symbol)
3131
{
3232
set_base_name(t.get(ID_C_base_name));
3333
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

0 commit comments

Comments
 (0)