Skip to content

codet API #4106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cpp/cpp_typecheck_initializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void cpp_typecheckt::zero_initializer(
code_assignt assign(object, *value);
assign.add_source_location()=source_location;

typecheck_expr(assign.op0());
typecheck_expr(assign.lhs());
assign.lhs().type().set(ID_C_constant, false);
already_typechecked(assign.lhs());

Expand Down
4 changes: 2 additions & 2 deletions src/goto-instrument/accelerate/accelerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void acceleratet::add_dirty_checks()
// variables is clean _before_ clearing any dirty flags.
if(it->is_assign())
{
exprt &lhs=it->code.op0();
exprt &lhs = it->get_assign().lhs();
expr_mapt::iterator dirty_var=dirty_vars_map.find(lhs);

if(dirty_var!=dirty_vars_map.end())
Expand All @@ -398,7 +398,7 @@ void acceleratet::add_dirty_checks()

if(it->is_assign())
{
find_symbols(it->code.op1(), read);
find_symbols(it->get_assign().rhs(), read);
}

for(find_symbols_sett::iterator jt=read.begin();
Expand Down
4 changes: 2 additions & 2 deletions src/goto-instrument/accelerate/acceleration_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,8 +927,8 @@ bool acceleration_utilst::do_nonrecursive(
{
if(it->is_assign())
{
exprt lhs=it->code.op0();
exprt rhs=it->code.op1();
exprt lhs = it->get_assign().lhs();
exprt rhs = it->get_assign().rhs();

if(lhs.id()==ID_dereference)
{
Expand Down
4 changes: 2 additions & 2 deletions src/goto-instrument/rw_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ void _rw_set_loct::compute()
{
if(target->is_assign())
{
assert(target->code.operands().size()==2);
assign(target->code.op0(), target->code.op1());
const auto &assignment = target->get_assign();
assign(assignment.lhs(), assignment.rhs());
}
else if(target->is_goto() ||
target->is_assume() ||
Expand Down
7 changes: 4 additions & 3 deletions src/goto-programs/goto_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,19 @@ void goto_convertt::convert_label(
// the body of the thread is expected to be
// in the operand.
DATA_INVARIANT(
code.op0().is_not_nil(), "op0 in magic thread creation label is null");
to_code_label(code).code().is_not_nil(),
"code() in magic thread creation label is null");

// replace the magic thread creation label with a
// thread block (START_THREAD...END_THREAD).
code_blockt thread_body;
thread_body.add(to_code(code.op0()));
thread_body.add(to_code_label(code).code());
thread_body.add_source_location()=code.source_location();
generate_thread_block(thread_body, dest, mode);
}
else
{
convert(to_code(code.op0()), tmp, mode);
convert(to_code_label(code).code(), tmp, mode);

goto_programt::targett target=tmp.instructions.begin();
dest.destructive_append(tmp);
Expand Down
6 changes: 3 additions & 3 deletions src/jsil/jsil_typecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,10 @@ void jsil_typecheckt::typecheck_ifthenelse(code_ifthenelset &code)

void jsil_typecheckt::typecheck_assign(code_assignt &code)
{
typecheck_expr(code.op0());
typecheck_expr(code.op1());
typecheck_expr(code.lhs());
typecheck_expr(code.rhs());

make_type_compatible(code.op0(), code.op1().type(), false);
make_type_compatible(code.lhs(), code.rhs().type(), false);
}

/// typechecking procedure declaration; any other symbols should have been
Expand Down
5 changes: 3 additions & 2 deletions src/pointer-analysis/goto_program_dereference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,9 @@ void goto_program_dereferencet::dereference_instruction(
function_call.function(),
checks_only,
value_set_dereferencet::modet::READ);
dereference_expr(
function_call.op2(), checks_only, value_set_dereferencet::modet::READ);

for(auto &arg : function_call.arguments())
dereference_expr(arg, checks_only, value_set_dereferencet::modet::READ);
}
else if(i.is_return())
{
Expand Down
2 changes: 1 addition & 1 deletion src/pointer-analysis/value_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ void value_sett::apply_code_rec(
}
else if(statement==ID_assume)
{
guard(to_code_assume(code).op0(), ns);
guard(to_code_assume(code).assumption(), ns);
}
else if(statement==ID_user_specified_predicate ||
statement==ID_user_specified_parameter_predicates ||
Expand Down
Loading