Skip to content
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
4 changes: 2 additions & 2 deletions src/cpp/cpp_instantiate_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ const symbolt &cpp_typecheckt::class_template_symbol(
void cpp_typecheckt::elaborate_class_template(
const typet &type)
{
if(type.id() != ID_symbol_type)
if(type.id() != ID_struct_tag)
return;

const symbolt &symbol = lookup(to_symbol_type(type));
const symbolt &symbol = lookup(to_struct_tag_type(type));

// Make a copy, as instantiate will destroy the symbol type!
const typet t_type=symbol.type;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/cpp_typecheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class cpp_typecheckt:public c_typecheck_baset

void elaborate_class_template(
const source_locationt &source_location,
const symbol_typet &type);
const struct_tag_typet &type);

unsigned template_counter;
unsigned anon_counter;
Expand Down
6 changes: 3 additions & 3 deletions src/cpp/cpp_typecheck_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void cpp_typecheckt::default_assignop(
std::string arg_name("ref");

cpctor.add(ID_storage_spec).id(ID_cpp_storage_spec);
cpctor.type().id(ID_symbol_type);
cpctor.type().id(ID_struct_tag);
cpctor.type().add(ID_identifier).id(symbol.name);
cpctor.operands().push_back(exprt(ID_cpp_declarator));
cpctor.add_source_location()=source_location;
Expand Down Expand Up @@ -488,7 +488,7 @@ void cpp_typecheckt::check_member_initializers(
// Maybe it is a parent constructor?
if(c.get_bool(ID_is_type))
{
if(c.type().id() != ID_symbol_type)
if(c.type().id() != ID_struct_tag)
continue;

const symbolt &symb = lookup(to_symbol_type(c.type()).get_identifier());
Expand Down Expand Up @@ -646,7 +646,7 @@ void cpp_typecheckt::full_member_initialization(

typecheck_type(member_type);

if(member_type.id() != ID_symbol_type)
if(member_type.id() != ID_struct_tag)
break;

if(
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/cpp_typecheck_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ bool cpp_typecheckt::operator_is_overloaded(exprt &expr)
// TODO: need to resolve an incomplete struct (template) here
// go into scope of first operand
if(
expr.op0().type().id() == ID_symbol_type &&
expr.op0().type().id() == ID_struct_tag &&
follow(expr.op0().type()).id() == ID_struct)
{
const irep_idt &struct_identifier=
Expand Down
38 changes: 13 additions & 25 deletions src/cpp/cpp_typecheck_resolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,13 @@ exprt cpp_typecheck_resolvet::convert_identifier(
{
e.type()=c_enum_tag_typet(symbol.name);
}
else // will need to do struct, union
else if(symbol.type.id() == ID_struct)
{
e.type()=symbol_typet(symbol.name);
e.type() = struct_tag_typet(symbol.name);
}
else if(symbol.type.id() == ID_union)
{
e.type() = union_tag_typet(symbol.name);
}
}
else if(symbol.is_macro)
Expand Down Expand Up @@ -908,7 +912,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope(
cpp_typecheck.cpp_scopes.current_scope().print(std::cout);
std::cout << "X: " << id_set.size() << '\n';
#endif
symbol_typet instance=
struct_tag_typet instance =
disambiguate_template_classes(final_base_name, id_set, template_args);

instance.add_source_location()=source_location;
Expand Down Expand Up @@ -954,7 +958,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope(
// the "::" triggers template elaboration
if(!cpp_typecheck.cpp_scopes.current_scope().class_identifier.empty())
{
symbol_typet instance(
struct_tag_typet instance(
cpp_typecheck.cpp_scopes.current_scope().class_identifier);
cpp_typecheck.elaborate_class_template(instance);
}
Expand Down Expand Up @@ -996,7 +1000,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope(
}

/// disambiguate partial specialization
symbol_typet cpp_typecheck_resolvet::disambiguate_template_classes(
struct_tag_typet cpp_typecheck_resolvet::disambiguate_template_classes(
const irep_idt &base_name,
const cpp_scopest::id_sett &id_set,
const cpp_template_args_non_tct &full_template_args)
Expand Down Expand Up @@ -1192,7 +1196,7 @@ symbol_typet cpp_typecheck_resolvet::disambiguate_template_classes(
throw 0;
}

symbol_typet result(instance.name);
struct_tag_typet result(instance.name);
result.add_source_location()=source_location;

return result;
Expand All @@ -1206,7 +1210,7 @@ symbol_typet cpp_typecheck_resolvet::disambiguate_template_classes(
match.specialization_args,
match.full_args);

symbol_typet result(instance.name);
struct_tag_typet result(instance.name);
result.add_source_location()=source_location;

return result;
Expand Down Expand Up @@ -2072,7 +2076,7 @@ void cpp_typecheck_resolvet::apply_template_args(
template_args_tc,
template_args_tc);

expr=exprt(ID_type, symbol_typet(new_symbol.name));
expr = type_exprt(struct_tag_typet(new_symbol.name));
expr.add_source_location()=source_location;
}
else
Expand Down Expand Up @@ -2208,21 +2212,7 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
irep_idt identifier=id.identifier;

if(id.is_member)
{
struct_typet struct_type=
static_cast<const struct_typet &>(
cpp_typecheck.lookup(id.class_identifier).type);
const exprt pcomp=struct_type.get_component(identifier);
assert(pcomp.is_not_nil());
assert(pcomp.get_bool(ID_is_type));
const typet &type=pcomp.type();
assert(type.id()!=ID_struct);

if(type.id() == ID_symbol_type)
identifier = to_symbol_type(type).get_identifier();
else
continue;
}
continue;

while(true)
{
Expand All @@ -2240,8 +2230,6 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
new_set.insert(&class_id);
break;
}
else if(symbol.type.id() == ID_symbol_type)
identifier = to_symbol_type(symbol.type).get_identifier();
else
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/cpp_typecheck_resolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class cpp_typecheck_resolvet
resolve_identifierst &identifiers,
const wantt want);

symbol_typet disambiguate_template_classes(
struct_tag_typet disambiguate_template_classes(
const irep_idt &base_name,
const cpp_scopest::id_sett &id_set,
const cpp_template_args_non_tct &template_args);
Expand Down