Skip to content

Commit 309e1e3

Browse files
committed
Introduce symbol_exprt::typeless
This is a constructor-wrapper to generate symbol_exprt without a type in a non-deprecated fashion. Use with care, as indicated in the comment.
1 parent bafd7e7 commit 309e1e3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/util/std_expr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ class symbol_exprt : public nullary_exprt
179179
set_identifier(identifier);
180180
}
181181

182+
/// Generate a symbol_exprt without a proper type. Use if, and only if, the
183+
/// type either cannot be determined just yet (such as during type checking) or
184+
/// when the type truly is immaterial. The latter case may better be dealt
185+
/// with by using just an irep_idt, and not a symbol_exprt.
186+
static symbol_exprt typeless(const irep_idt &id)
187+
{
188+
return symbol_exprt(id, typet());
189+
}
190+
182191
void set_identifier(const irep_idt &identifier)
183192
{
184193
set(ID_identifier, identifier);

0 commit comments

Comments
 (0)