Skip to content

Commit c2b1573

Browse files
authored
Merge pull request #3745 from diffblue/cpp-remove-symbol_type
C++: remove symbol_type
2 parents c509d28 + 81c12bd commit c2b1573

9 files changed

+8
-82
lines changed

src/cpp/cpp_convert_type.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,7 @@ void cpp_convert_plain_type(typet &type)
589589
type.id() == ID_union || type.id() == ID_array || type.id() == ID_code ||
590590
type.id() == ID_unsignedbv || type.id() == ID_signedbv ||
591591
type.id() == ID_bool || type.id() == ID_floatbv || type.id() == ID_empty ||
592-
type.id() == ID_symbol_type || type.id() == ID_constructor ||
593-
type.id() == ID_destructor)
592+
type.id() == ID_constructor || type.id() == ID_destructor)
594593
{
595594
}
596595
else if(type.id()==ID_c_enum)

src/cpp/cpp_declarator_converter.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ symbolt &cpp_declarator_convertert::convert(
142142
cpp_typecheck_resolvet::wantt::TYPE,
143143
cpp_typecheck_fargst());
144144

145-
if(
146-
symbol_expr.id() != ID_type ||
147-
symbol_expr.type().id() != ID_symbol_type)
145+
if(symbol_expr.id() != ID_type)
148146
{
149147
cpp_typecheck.error().source_location=name.source_location();
150148
cpp_typecheck.error() << "error: expected type"

src/cpp/cpp_exception_id.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ void cpp_exception_list_rec(
2121
const std::string &suffix,
2222
std::vector<irep_idt> &dest)
2323
{
24-
if(src.id() == ID_symbol_type)
25-
{
26-
cpp_exception_list_rec(ns.follow(src), ns, suffix, dest);
27-
}
28-
else if(src.id()==ID_pointer)
24+
if(src.id() == ID_pointer)
2925
{
3026
if(src.get_bool(ID_C_reference))
3127
{

src/cpp/cpp_instantiate_template.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ 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_type)
50-
result += id2string(to_symbol_type(type).get_identifier());
51-
else if(type.id() == ID_struct_tag ||
52-
type.id() == ID_union_tag)
49+
if(type.id() == ID_struct_tag || type.id() == ID_union_tag)
5350
result += id2string(to_tag_type(type).get_identifier());
5451
else
5552
result+=cpp_type2name(type);

src/cpp/cpp_is_pod.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ bool cpp_typecheckt::cpp_is_pod(const typet &type) const
7979
// but pointers are PODs!
8080
return true;
8181
}
82-
else if(type.id() == ID_symbol_type)
83-
{
84-
const symbolt &symb = lookup(to_symbol_type(type));
85-
DATA_INVARIANT(symb.is_type, "type symbol is a type");
86-
return cpp_is_pod(symb.type);
87-
}
8882
else if(type.id() == ID_struct_tag ||
8983
type.id() == ID_union_tag)
9084
{

src/cpp/cpp_typecheck_bases.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ void cpp_typecheckt::typecheck_compound_bases(struct_typet &type)
4343
// elaborate any class template instances given as bases
4444
elaborate_class_template(base_symbol_expr.type());
4545

46-
if(base_symbol_expr.type().id() == ID_symbol_type)
47-
base_symbol_expr.type().id(ID_struct_tag);
48-
4946
if(base_symbol_expr.type().id() != ID_struct_tag)
5047
{
5148
error().source_location=name.source_location();

src/cpp/cpp_typecheck_resolve.cpp

+4-15
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ void cpp_typecheck_resolvet::remove_duplicates(
160160

161161
if(old_id.id() == ID_symbol)
162162
id = to_symbol_expr(old_id).get_identifier();
163-
else if(old_id.id() == ID_type && old_id.type().id() == ID_symbol_type)
164-
id = to_symbol_type(old_id.type()).get_identifier();
165163
else if(old_id.id() == ID_type && old_id.type().id() == ID_struct_tag)
166164
id = to_struct_tag_type(old_id.type()).get_identifier();
167165
else if(old_id.id() == ID_type && old_id.type().id() == ID_union_tag)
@@ -353,20 +351,11 @@ exprt cpp_typecheck_resolvet::convert_identifier(
353351
}
354352
else
355353
{
356-
typet followed_type=symbol.type;
357-
bool constant=followed_type.get_bool(ID_C_constant);
354+
bool constant = symbol.type.get_bool(ID_C_constant);
358355

359-
while(followed_type.id() == ID_symbol_type)
360-
{
361-
followed_type =
362-
cpp_typecheck.follow(to_symbol_type(followed_type));
363-
constant |= followed_type.get_bool(ID_C_constant);
364-
}
365-
366-
if(constant &&
367-
symbol.value.is_not_nil() &&
368-
is_number(followed_type) &&
369-
symbol.value.id() == ID_constant)
356+
if(
357+
constant && symbol.value.is_not_nil() && is_number(symbol.type) &&
358+
symbol.value.id() == ID_constant)
370359
{
371360
e=symbol.value;
372361
}

src/cpp/cpp_typecheck_type.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ void cpp_typecheckt::typecheck_type(typet &type)
184184
type.id() == ID_fixedbv || type.id() == ID_empty)
185185
{
186186
}
187-
else if(type.id() == ID_symbol_type)
188-
{
189-
}
190187
else if(type.id() == ID_struct_tag)
191188
{
192189
}

src/cpp/expr2cpp.cpp

-41
Original file line numberDiff line numberDiff line change
@@ -154,47 +154,6 @@ std::string expr2cppt::convert_rec(
154154
else
155155
return expr2ct::convert_rec(src, qualifiers, declarator);
156156
}
157-
else if(src.id() == ID_symbol_type)
158-
{
159-
const irep_idt &identifier=
160-
to_symbol_type(src).get_identifier();
161-
162-
const symbolt &symbol=ns.lookup(identifier);
163-
164-
if(symbol.type.id() == ID_struct)
165-
{
166-
std::string dest=q;
167-
168-
if(symbol.type.get_bool(ID_C_class))
169-
dest+="class";
170-
else if(symbol.type.get_bool(ID_C_interface))
171-
dest+="__interface"; // MS-specific
172-
else
173-
dest+="struct";
174-
175-
if(!symbol.pretty_name.empty())
176-
dest+=" "+id2string(symbol.pretty_name);
177-
178-
dest+=d;
179-
180-
return dest;
181-
}
182-
else if(symbol.type.id()==ID_c_enum)
183-
{
184-
std::string dest=q;
185-
186-
dest+="enum";
187-
188-
if(!symbol.pretty_name.empty())
189-
dest+=" "+id2string(symbol.pretty_name);
190-
191-
dest+=d;
192-
193-
return dest;
194-
}
195-
else
196-
return expr2ct::convert_rec(src, qualifiers, declarator);
197-
}
198157
else if(src.id() == ID_struct)
199158
{
200159
std::string dest=q;

0 commit comments

Comments
 (0)