Skip to content

Commit 04c26c4

Browse files
author
Daniel Kroening
committed
introduce struct tag types
1 parent 8e6ed7d commit 04c26c4

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/ansi-c/c_typecheck_type.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -822,18 +822,17 @@ void c_typecheck_baset::typecheck_compound_type(struct_union_typet &type)
822822

823823
c_qualifierst original_qualifiers(type);
824824

825-
if(type.id() == ID_union)
826-
{
827-
union_tag_typet tag_type(identifier);
828-
tag_type.add_source_location() = type.source_location();
829-
type.swap(tag_type);
830-
}
825+
typet tag_type;
826+
827+
if(type.id() == ID_union || type.id() == ID_incomplete_union)
828+
tag_type = union_tag_typet(identifier);
829+
else if(type.id() == ID_struct || type.id() == ID_incomplete_struct)
830+
tag_type = struct_tag_typet(identifier);
831831
else
832-
{
833-
symbol_typet symbol_type(identifier);
834-
symbol_type.add_source_location() = type.source_location();
835-
type.swap(symbol_type);
836-
}
832+
UNREACHABLE;
833+
834+
tag_type.add_source_location() = type.source_location();
835+
type.swap(tag_type);
837836

838837
original_qualifiers.write(type);
839838
}

0 commit comments

Comments
 (0)