Skip to content

Commit cebbbd5

Browse files
author
Daniel Kroening
committed
further support for tag types
1 parent 2c47e04 commit cebbbd5

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/cpp/cpp_exception_id.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ void cpp_exception_list_rec(
3838
cpp_exception_list_rec(src.subtype(), ns, "_ptr"+suffix, dest);
3939
}
4040
}
41+
else if(src.id() == ID_union_tag)
42+
{
43+
cpp_exception_list_rec(ns.follow_tag(to_union_tag_type(src)), ns, suffix, dest);
44+
}
4145
else if(src.id()==ID_union)
4246
{
4347
// just get tag
4448
dest.push_back("union_"+src.get_string(ID_tag));
4549
}
50+
else if(src.id() == ID_struct_tag)
51+
{
52+
cpp_exception_list_rec(ns.follow_tag(to_struct_tag_type(src)), ns, suffix, dest);
53+
}
4654
else if(src.id()==ID_struct)
4755
{
4856
// just get tag

src/cpp/cpp_instantiate_template.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ std::string cpp_typecheckt::template_suffix(
4848
const typet &type=expr.type();
4949
if(type.id() == ID_symbol_type)
5050
result += id2string(to_symbol_type(type).get_identifier());
51+
else if(type.id() == ID_struct_tag ||
52+
type.id() == ID_union_tag)
53+
result += id2string(to_tag_type(type).get_identifier());
5154
else
5255
result+=cpp_type2name(type);
5356
}

src/cpp/cpp_is_pod.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ bool cpp_typecheckt::cpp_is_pod(const typet &type) const
8282
DATA_INVARIANT(symb.is_type, "type symbol is a type");
8383
return cpp_is_pod(symb.type);
8484
}
85+
else if(type.id() == ID_struct_tag ||
86+
type.id() == ID_union_tag)
87+
{
88+
const symbolt &symb = lookup(to_tag_type(type));
89+
DATA_INVARIANT(symb.is_type, "tag symbol is a type");
90+
return cpp_is_pod(symb.type);
91+
}
8592

8693
// everything else is POD
8794
return true;

0 commit comments

Comments
 (0)