@@ -10,25 +10,23 @@ Author: Daniel Kroening, kroening@kroening.com
1010// / Dump Goto-Program as C/C++ Source
1111
1212#include " dump_c.h"
13+ #include " dump_c_class.h"
1314
1415#include < util/byte_operators.h>
1516#include < util/c_types.h>
1617#include < util/config.h>
1718#include < util/expr_initializer.h>
19+ #include < util/expr_util.h>
1820#include < util/find_symbols.h>
1921#include < util/get_base_name.h>
2022#include < util/invariant.h>
21- #include < util/namespace.h>
2223#include < util/replace_symbol.h>
23- #include < util/std_code.h>
2424#include < util/string_utils.h>
2525
2626#include < ansi-c/expr2c.h>
2727#include < cpp/expr2cpp.h>
28-
2928#include < linking/static_lifetime_init.h>
3029
31- #include " dump_c_class.h"
3230#include " goto_program2code.h"
3331
3432dump_c_configurationt dump_c_configurationt::default_configuration =
@@ -1325,11 +1323,9 @@ void dump_ct::cleanup_expr(exprt &expr)
13251323 expr = struct_exprt ({}, struct_typet ());
13261324 }
13271325 // add a typecast for NULL
1328- else if (u.op ().id ()==ID_constant &&
1329- u.op ().type ().id ()==ID_pointer &&
1330- u.op ().type ().subtype ().id ()==ID_empty &&
1331- (u.op ().is_zero () ||
1332- to_constant_expr (u.op ()).get_value ()==ID_NULL))
1326+ else if (
1327+ u.op ().id () == ID_constant && is_null_pointer (to_constant_expr (u.op ())) &&
1328+ u.op ().type ().subtype ().id () == ID_empty)
13331329 {
13341330 const struct_union_typet::componentt &comp=
13351331 u_type_f.get_component (u.get_component_name ());
@@ -1385,8 +1381,7 @@ void dump_ct::cleanup_expr(exprt &expr)
13851381 // add a typecast for NULL or 0
13861382 if (
13871383 argument.id () == ID_constant &&
1388- (argument.is_zero () ||
1389- to_constant_expr (argument).get_value () == ID_NULL))
1384+ is_null_pointer (to_constant_expr (argument)))
13901385 {
13911386 const typet &comp_type=
13921387 to_union_type (type).components ().front ().type ();
0 commit comments