Skip to content

Commit 17bca0a

Browse files
author
Daniel Kroening
committed
base types are symbol_typet
1 parent a9b9754 commit 17bca0a

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

jbmc/src/java_bytecode/java_static_initializers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static void clinit_wrapper_do_recursive_calls(
203203
const symbolt &class_symbol = symbol_table.lookup_ref(class_name);
204204
for(const auto &base : to_class_type(class_symbol.type).bases())
205205
{
206-
const auto base_name = to_symbol_type(base.type()).get_identifier();
206+
const auto base_name = base.type().get_identifier();
207207
irep_idt base_init_routine = clinit_wrapper_name(base_name);
208208
auto findit = symbol_table.symbols.find(base_init_routine);
209209
if(findit == symbol_table.symbols.end())
@@ -286,7 +286,7 @@ static bool needs_clinit_wrapper(
286286
for(const class_typet::baset &base : class_type.bases())
287287
{
288288
if(symbol_table.has_symbol(
289-
clinit_wrapper_name(to_symbol_type(base.type()).get_identifier())))
289+
clinit_wrapper_name(base.type().get_identifier())))
290290
{
291291
return true;
292292
}

src/cpp/cpp_typecheck_bases.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void cpp_typecheckt::add_base_components(
150150
else if(access==ID_protected && sub_access!=ID_private)
151151
sub_access=ID_protected;
152152

153-
const symbolt &symb = lookup(to_symbol_type(b.type()).get_identifier());
153+
const symbolt &symb = lookup(b.type());
154154

155155
const bool is_virtual = b.get_bool(ID_virtual);
156156

src/cpp/cpp_typecheck_compound_type.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,8 +1646,7 @@ void cpp_typecheckt::get_bases(
16461646
{
16471647
DATA_INVARIANT(b.id() == ID_base, "base class expression expected");
16481648

1649-
const struct_typet &base =
1650-
to_struct_type(lookup(to_symbol_type(b.type()).get_identifier()).type);
1649+
const struct_typet &base = to_struct_type(lookup(b.type()).type);
16511650

16521651
set_bases.insert(base.get(ID_name));
16531652
get_bases(base, set_bases);
@@ -1665,8 +1664,7 @@ void cpp_typecheckt::get_virtual_bases(
16651664
{
16661665
DATA_INVARIANT(b.id() == ID_base, "base class expression expected");
16671666

1668-
const struct_typet &base =
1669-
to_struct_type(lookup(to_symbol_type(b.type()).get_identifier()).type);
1667+
const struct_typet &base = to_struct_type(lookup(b.type()).type);
16701668

16711669
if(b.get_bool(ID_virtual))
16721670
vbases.push_back(base.get(ID_name));

src/cpp/cpp_typecheck_constructor.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void cpp_typecheckt::default_cpctor(
190190
{
191191
DATA_INVARIANT(b.id() == ID_base, "base class expression expected");
192192

193-
const symbolt &parsymb = lookup(to_symbol_type(b.type()).get_identifier());
193+
const symbolt &parsymb = lookup(b.type());
194194

195195
if(cpp_is_pod(parsymb.type))
196196
copy_parent(source_location, parsymb.base_name, param_identifier, block);
@@ -359,7 +359,7 @@ void cpp_typecheckt::default_assignop_value(
359359
{
360360
DATA_INVARIANT(b.id() == ID_base, "base class expression expected");
361361

362-
const symbolt &symb = lookup(to_symbol_type(b.type()).get_identifier());
362+
const symbolt &symb = lookup(b.type());
363363

364364
copy_parent(source_location, symb.base_name, arg_name, block);
365365
}
@@ -595,8 +595,7 @@ void cpp_typecheckt::full_member_initialization(
595595
{
596596
DATA_INVARIANT(b.id() == ID_base, "base class expression expected");
597597

598-
const symbolt &ctorsymb =
599-
lookup(to_symbol_type(b.type()).get_identifier());
598+
const symbolt &ctorsymb = lookup(b.type());
600599

601600
if(cpp_is_pod(ctorsymb.type))
602601
continue;

src/cpp/cpp_typecheck_destructor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ codet cpp_typecheckt::dtor(const symbolt &symbol)
141141
bit++)
142142
{
143143
DATA_INVARIANT(bit->id() == ID_base, "base class expression expected");
144-
const symbolt &psymb = lookup(to_symbol_type(bit->type()).get_identifier());
144+
const symbolt &psymb = lookup(bit->type());
145145

146146
symbol_exprt this_ptr(ID_this, pointer_type(symbol.type));
147147
dereference_exprt object(this_ptr, psymb.type);

src/cpp/cpp_typecheck_expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bool cpp_typecheckt::find_parent(
3535
{
3636
for(const auto &b : to_struct_type(symb.type).bases())
3737
{
38-
const irep_idt &id = to_symbol_type(b.type()).get_identifier();
38+
const irep_idt &id = b.type().get_identifier();
3939
if(lookup(id).base_name == base_name)
4040
{
4141
identifier = id;

src/util/std_types.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,17 @@ class struct_typet:public struct_union_typet
291291
class baset : public exprt
292292
{
293293
public:
294-
explicit baset(const typet &base) : exprt(ID_base, base)
294+
symbol_typet &type()
295+
{
296+
return to_symbol_type(exprt::type());
297+
}
298+
299+
const symbol_typet &type() const
300+
{
301+
return to_symbol_type(exprt::type());
302+
}
303+
304+
explicit baset(const symbol_typet &base) : exprt(ID_base, base)
295305
{
296306
}
297307
};

0 commit comments

Comments
 (0)