Skip to content

Commit e8c4bfe

Browse files
author
Daniel Kroening
committed
codet now inherits from irept
1 parent 992a1ae commit e8c4bfe

File tree

7 files changed

+203
-70
lines changed

7 files changed

+203
-70
lines changed

src/ansi-c/c_typecheck_code.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ void c_typecheck_baset::typecheck_code(codet &code)
3030
throw 0;
3131
}
3232

33-
code.type()=code_typet();
34-
3533
const irep_idt &statement=code.get_statement();
3634

3735
if(statement==ID_expression)

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ void c_typecheck_baset::typecheck_expr_operands(exprt &expr)
771771
code_declt decl(symbol.symbol_expr());
772772
decl.add_source_location()=declaration.source_location();
773773

774-
expr.op0()=decl;
774+
expr.get_sub()[0] = decl;
775775

776776
typecheck_expr(expr.op1());
777777
}
@@ -1012,7 +1012,7 @@ void c_typecheck_baset::typecheck_expr_sizeof(exprt &expr)
10121012
ID_statement_expression, void_type(), expr.source_location());
10131013
auto decl_block=code_blockt::from_list(clean_code);
10141014
decl_block.set_statement(ID_decl_block);
1015-
side_effect_expr.copy_to_operands(decl_block);
1015+
side_effect_expr.get_sub().push_back(decl_block);
10161016
clean_code.clear();
10171017

10181018
// We merge the side-effect into the operand of the typecast,
@@ -1069,7 +1069,7 @@ void c_typecheck_baset::typecheck_expr_typecast(exprt &expr)
10691069
ID_statement_expression, void_type(), expr.source_location());
10701070
auto decl_block=code_blockt::from_list(clean_code);
10711071
decl_block.set_statement(ID_decl_block);
1072-
side_effect_expr.copy_to_operands(decl_block);
1072+
side_effect_expr.get_sub().push_back(decl_block);
10731073
clean_code.clear();
10741074

10751075
// We merge the side-effect into the operand of the typecast,

src/goto-symex/goto_symex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ class goto_symext
248248
// c) clean up byte_extract on the lhs of an assignment
249249
void clean_expr(
250250
exprt &, statet &, bool write);
251+
void clean_expr(codet &, statet &, bool write);
251252

252253
void trigger_auto_object(const exprt &, statet &);
253254
void initialize_auto_object(const exprt &, statet &);
@@ -454,7 +455,7 @@ class goto_symext
454455
virtual void symex_fkt(statet &, const code_function_callt &);
455456
virtual void symex_macro(statet &, const code_function_callt &);
456457
virtual void symex_trace(statet &, const code_function_callt &);
457-
virtual void symex_printf(statet &, const exprt &rhs);
458+
virtual void symex_printf(statet &, const irept &);
458459
virtual void symex_input(statet &, const codet &);
459460
virtual void symex_output(statet &, const codet &);
460461

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,11 @@ irep_idt get_string_argument(const exprt &src, const namespacet &ns)
306306
return get_string_argument_rec(tmp);
307307
}
308308

309-
void goto_symext::symex_printf(
310-
statet &state,
311-
const exprt &rhs)
309+
void goto_symext::symex_printf(statet &state, const irept &rhs)
312310
{
313311
PRECONDITION(!rhs.operands().empty());
314312

313+
#if 0
315314
exprt tmp_rhs=rhs;
316315
state.rename(tmp_rhs, ns);
317316
do_simplify(tmp_rhs);
@@ -329,6 +328,7 @@ void goto_symext::symex_printf(
329328
target.output_fmt(
330329
state.guard.as_expr(),
331330
state.source, "printf", format_string, args);
331+
#endif
332332
}
333333

334334
void goto_symext::symex_input(

src/linking/static_lifetime_init.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ void static_lifetime_init(
3333

3434
symbolt &init_symbol = symbol_table.get_writeable_ref(INITIALIZE_FUNCTION);
3535

36-
init_symbol.value=code_blockt();
37-
init_symbol.value.add_source_location()=source_location;
38-
39-
code_blockt &dest=to_code_block(to_code(init_symbol.value));
36+
code_blockt dest;
37+
dest.add_source_location() = source_location;
4038

4139
// add the magic label to hide
4240
dest.add(code_labelt("__CPROVER_HIDE", code_skipt()));
@@ -149,4 +147,6 @@ void static_lifetime_init(
149147
dest.add(function_call);
150148
}
151149
}
150+
151+
init_symbol.value = dest.as_expr();
152152
}

0 commit comments

Comments
 (0)