Skip to content

C++: remove symbol_type #3745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/cpp/cpp_convert_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,7 @@ void cpp_convert_plain_type(typet &type)
type.id() == ID_union || type.id() == ID_array || type.id() == ID_code ||
type.id() == ID_unsignedbv || type.id() == ID_signedbv ||
type.id() == ID_bool || type.id() == ID_floatbv || type.id() == ID_empty ||
type.id() == ID_symbol_type || type.id() == ID_constructor ||
type.id() == ID_destructor)
type.id() == ID_constructor || type.id() == ID_destructor)
{
}
else if(type.id()==ID_c_enum)
Expand Down
4 changes: 1 addition & 3 deletions src/cpp/cpp_declarator_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ symbolt &cpp_declarator_convertert::convert(
cpp_typecheck_resolvet::wantt::TYPE,
cpp_typecheck_fargst());

if(
symbol_expr.id() != ID_type ||
symbol_expr.type().id() != ID_symbol_type)
if(symbol_expr.id() != ID_type)
{
cpp_typecheck.error().source_location=name.source_location();
cpp_typecheck.error() << "error: expected type"
Expand Down
6 changes: 1 addition & 5 deletions src/cpp/cpp_exception_id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ void cpp_exception_list_rec(
const std::string &suffix,
std::vector<irep_idt> &dest)
{
if(src.id() == ID_symbol_type)
{
cpp_exception_list_rec(ns.follow(src), ns, suffix, dest);
}
else if(src.id()==ID_pointer)
if(src.id() == ID_pointer)
{
if(src.get_bool(ID_C_reference))
{
Expand Down
5 changes: 1 addition & 4 deletions src/cpp/cpp_instantiate_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ std::string cpp_typecheckt::template_suffix(
if(expr.id()==ID_type)
{
const typet &type=expr.type();
if(type.id() == ID_symbol_type)
result += id2string(to_symbol_type(type).get_identifier());
else if(type.id() == ID_struct_tag ||
type.id() == ID_union_tag)
if(type.id() == ID_struct_tag || type.id() == ID_union_tag)
result += id2string(to_tag_type(type).get_identifier());
else
result+=cpp_type2name(type);
Expand Down
6 changes: 0 additions & 6 deletions src/cpp/cpp_is_pod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ bool cpp_typecheckt::cpp_is_pod(const typet &type) const
// but pointers are PODs!
return true;
}
else if(type.id() == ID_symbol_type)
{
const symbolt &symb = lookup(to_symbol_type(type));
DATA_INVARIANT(symb.is_type, "type symbol is a type");
return cpp_is_pod(symb.type);
}
else if(type.id() == ID_struct_tag ||
type.id() == ID_union_tag)
{
Expand Down
3 changes: 0 additions & 3 deletions src/cpp/cpp_typecheck_bases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ void cpp_typecheckt::typecheck_compound_bases(struct_typet &type)
// elaborate any class template instances given as bases
elaborate_class_template(base_symbol_expr.type());

if(base_symbol_expr.type().id() == ID_symbol_type)
base_symbol_expr.type().id(ID_struct_tag);

if(base_symbol_expr.type().id() != ID_struct_tag)
{
error().source_location=name.source_location();
Expand Down
19 changes: 4 additions & 15 deletions src/cpp/cpp_typecheck_resolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ void cpp_typecheck_resolvet::remove_duplicates(

if(old_id.id() == ID_symbol)
id = to_symbol_expr(old_id).get_identifier();
else if(old_id.id() == ID_type && old_id.type().id() == ID_symbol_type)
id = to_symbol_type(old_id.type()).get_identifier();
else if(old_id.id() == ID_type && old_id.type().id() == ID_struct_tag)
id = to_struct_tag_type(old_id.type()).get_identifier();
else if(old_id.id() == ID_type && old_id.type().id() == ID_union_tag)
Expand Down Expand Up @@ -353,20 +351,11 @@ exprt cpp_typecheck_resolvet::convert_identifier(
}
else
{
typet followed_type=symbol.type;
bool constant=followed_type.get_bool(ID_C_constant);
bool constant = symbol.type.get_bool(ID_C_constant);

while(followed_type.id() == ID_symbol_type)
{
followed_type =
cpp_typecheck.follow(to_symbol_type(followed_type));
constant |= followed_type.get_bool(ID_C_constant);
}

if(constant &&
symbol.value.is_not_nil() &&
is_number(followed_type) &&
symbol.value.id() == ID_constant)
if(
constant && symbol.value.is_not_nil() && is_number(symbol.type) &&
symbol.value.id() == ID_constant)
{
e=symbol.value;
}
Expand Down
3 changes: 0 additions & 3 deletions src/cpp/cpp_typecheck_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ void cpp_typecheckt::typecheck_type(typet &type)
type.id() == ID_fixedbv || type.id() == ID_empty)
{
}
else if(type.id() == ID_symbol_type)
{
}
else if(type.id() == ID_struct_tag)
{
}
Expand Down
41 changes: 0 additions & 41 deletions src/cpp/expr2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,47 +154,6 @@ std::string expr2cppt::convert_rec(
else
return expr2ct::convert_rec(src, qualifiers, declarator);
}
else if(src.id() == ID_symbol_type)
{
const irep_idt &identifier=
to_symbol_type(src).get_identifier();

const symbolt &symbol=ns.lookup(identifier);

if(symbol.type.id() == ID_struct)
{
std::string dest=q;

if(symbol.type.get_bool(ID_C_class))
dest+="class";
else if(symbol.type.get_bool(ID_C_interface))
dest+="__interface"; // MS-specific
else
dest+="struct";

if(!symbol.pretty_name.empty())
dest+=" "+id2string(symbol.pretty_name);

dest+=d;

return dest;
}
else if(symbol.type.id()==ID_c_enum)
{
std::string dest=q;

dest+="enum";

if(!symbol.pretty_name.empty())
dest+=" "+id2string(symbol.pretty_name);

dest+=d;

return dest;
}
else
return expr2ct::convert_rec(src, qualifiers, declarator);
}
else if(src.id() == ID_struct)
{
std::string dest=q;
Expand Down