Skip to content

Commit e3232c7

Browse files
committed
Make void_type() return empty_typet()
This is consistent with what is done in the Java front-end. Also use the same trick to construct only a single, shared instance of it.
1 parent b04bb82 commit e3232c7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/util/c_types.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,10 @@ reference_typet reference_type(const typet &subtype)
250250
return reference_typet(subtype, config.ansi_c.pointer_width);
251251
}
252252

253-
typet void_type()
253+
empty_typet void_type()
254254
{
255-
return empty_typet();
255+
static const auto result = empty_typet();
256+
return result;
256257
}
257258

258259
std::string c_type_as_string(const irep_idt &c_type)

src/util/c_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ unsignedbv_typet size_type();
3636
signedbv_typet signed_size_type();
3737
signedbv_typet pointer_diff_type();
3838
pointer_typet pointer_type(const typet &);
39-
typet void_type();
39+
empty_typet void_type();
4040

4141
// This is for Java and C++
4242
reference_typet reference_type(const typet &);

0 commit comments

Comments
 (0)