Skip to content

instructiont::get_code -> code #6857

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 1 commit into from
May 15, 2022
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
8 changes: 4 additions & 4 deletions jbmc/src/java_bytecode/remove_exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void remove_exceptionst::instrument_exception_handler(
{
// retrieve the exception variable
const exprt &thrown_exception_local =
to_code_landingpad(instr_it->get_code()).catch_expr();
to_code_landingpad(instr_it->code()).catch_expr();

const symbol_exprt thrown_global_symbol=
get_inflight_exception_global();
Expand Down Expand Up @@ -407,7 +407,7 @@ bool remove_exceptionst::instrument_throw(
PRECONDITION(instr_it->type() == THROW);

const exprt &exc_expr =
uncaught_exceptions_domaint::get_exception_symbol(instr_it->get_code());
uncaught_exceptions_domaint::get_exception_symbol(instr_it->code());

add_exception_dispatch_sequence(
function_identifier, goto_program, instr_it, stack_catch, locals);
Expand Down Expand Up @@ -512,7 +512,7 @@ void remove_exceptionst::instrument_exceptions(
// Is it a handler push/pop or catch landing-pad?
else if(instr_it->type() == CATCH)
{
const irep_idt &statement = instr_it->get_code().get_statement();
const irep_idt &statement = instr_it->code().get_statement();
// Is it an exception landing pad (start of a catch block)?
if(statement==ID_exception_landingpad)
{
Expand Down Expand Up @@ -553,7 +553,7 @@ void remove_exceptionst::instrument_exceptions(

// copy targets
const code_push_catcht::exception_listt &exception_list =
to_code_push_catch(instr_it->get_code()).exception_list();
to_code_push_catch(instr_it->code()).exception_list();

// The target list can be empty if `finish_catch_push_targets` found that
// the targets were unreachable (in which case no exception can truly
Expand Down
4 changes: 2 additions & 2 deletions jbmc/src/java_bytecode/remove_instanceof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ bool remove_instanceoft::lower_instanceof(
goto_programt::targett target)
{
if(
target->is_target() && (contains_instanceof(target->get_code()) ||
contains_instanceof(target->guard)))
target->is_target() &&
(contains_instanceof(target->code()) || contains_instanceof(target->guard)))
{
// If this is a branch target, add a skip beforehand so we can splice new
// GOTO programs before the target instruction without inserting into the
Expand Down
4 changes: 2 additions & 2 deletions jbmc/src/java_bytecode/replace_java_nondet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ is_nondet_returning_object(const code_function_callt &function_call)
static nondet_instruction_infot
get_nondet_instruction_info(const goto_programt::const_targett &instr)
{
if(!(instr->is_function_call() && instr->get_code().id() == ID_code))
if(!(instr->is_function_call() && instr->code().id() == ID_code))
{
return nondet_instruction_infot();
}
const auto &code = instr->get_code();
const auto &code = instr->code();
INVARIANT(
code.get_statement() == ID_function_call,
"function_call should have ID_function_call");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ SCENARIO(
instrend = main_function.body.instructions.end();
instrit != instrend; ++instrit)
{
for(auto it = instrit->get_code().depth_begin(),
itend = instrit->get_code().depth_end();
for(auto it = instrit->code().depth_begin(),
itend = instrit->code().depth_end();
it != itend;
++it)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void validate_nondets_converted(
exprt target_expression =
(inst.is_assign()
? inst.assign_rhs()
: inst.is_set_return_value() ? inst.return_value() : inst.get_code());
: inst.is_set_return_value() ? inst.return_value() : inst.code());

if(
const auto side_effect =
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/cfg_dominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ inline void dominators_pretty_print_node(
const goto_programt::targett& target,
std::ostream& out)
{
out << target->get_code().pretty();
out << target->code().pretty();
}

/// Print the result of the dominator computation
Expand Down
6 changes: 3 additions & 3 deletions src/analyses/invariant_set_domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ void invariant_set_domaint::transform(

case OTHER:
if(from_l->get_other().is_not_nil())
invariant_set.apply_code(from_l->get_code());
invariant_set.apply_code(from_l->code());
break;

case DECL:
invariant_set.apply_code(from_l->get_code());
invariant_set.apply_code(from_l->code());
break;

case FUNCTION_CALL:
invariant_set.apply_code(from_l->get_code());
invariant_set.apply_code(from_l->code());
break;

case START_THREAD:
Expand Down
6 changes: 3 additions & 3 deletions src/analyses/uncaught_exceptions_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void uncaught_exceptions_domaint::transform(
{
case THROW:
{
const exprt &exc_symbol = get_exception_symbol(instruction.get_code());
const exprt &exc_symbol = get_exception_symbol(instruction.code());
// retrieve the static type of the thrown exception
const irep_idt &type_id =
get_exception_type(to_pointer_type(exc_symbol.type()));
Expand All @@ -85,15 +85,15 @@ void uncaught_exceptions_domaint::transform(
}
case CATCH:
{
if(!instruction.get_code().has_operands())
if(!instruction.code().has_operands())
{
if(!instruction.targets.empty()) // push
{
std::set<irep_idt> caught;
stack_caught.push_back(caught);
std::set<irep_idt> &last_caught=stack_caught.back();
const irept::subt &exception_list =
instruction.get_code().find(ID_exception_list).get_sub();
instruction.code().find(ID_exception_list).get_sub();

for(const auto &exc : exception_list)
{
Expand Down
3 changes: 1 addition & 2 deletions src/goto-instrument/contracts/instrument_spec_assigns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,8 +1021,7 @@ void instrument_spec_assignst::instrument_call_statement(

if(callee_name == "malloc")
{
const auto &function_call =
to_code_function_call(instruction_it->get_code());
const auto &function_call = to_code_function_call(instruction_it->code());
if(function_call.lhs().is_not_nil())
{
// grab the returned pointer from malloc
Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void dott::write_dot_subgraph(
it->is_assign() || it->is_decl() || it->is_set_return_value() ||
it->is_other())
{
std::string t = from_expr(ns, function_id, it->get_code());
std::string t = from_expr(ns, function_id, it->code());
while(t[ t.size()-1 ]=='\n')
t = t.substr(0, t.size()-1);
tmp.str(escape(t));
Expand Down
4 changes: 2 additions & 2 deletions src/goto-instrument/goto_instrument_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ int goto_instrument_parse_optionst::doit()
for(auto const &pair : goto_model.goto_functions.function_map)
for(auto const &ins : pair.second.body.instructions)
{
if(ins.get_code().is_not_nil())
log.status() << ins.get_code().pretty() << messaget::eom;
if(ins.code().is_not_nil())
log.status() << ins.code().pretty() << messaget::eom;
if(ins.has_condition())
{
log.status() << "[guard] " << ins.condition().pretty()
Expand Down
18 changes: 9 additions & 9 deletions src/goto-instrument/wmm/fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ bool is_fence(
"fence")
/* if assembly-sensitive algorithms are not available */
|| (instruction.is_other() &&
instruction.get_code().get_statement() == ID_fence &&
instruction.get_code().get_bool(ID_WWfence) &&
instruction.get_code().get_bool(ID_WRfence) &&
instruction.get_code().get_bool(ID_RWfence) &&
instruction.get_code().get_bool(ID_RRfence));
instruction.code().get_statement() == ID_fence &&
instruction.code().get_bool(ID_WWfence) &&
instruction.code().get_bool(ID_WRfence) &&
instruction.code().get_bool(ID_RWfence) &&
instruction.code().get_bool(ID_RRfence));
}

bool is_lwfence(
Expand All @@ -41,8 +41,8 @@ bool is_lwfence(
"lwfence")
/* if assembly-sensitive algorithms are not available */
|| (instruction.is_other() &&
instruction.get_code().get_statement() == ID_fence &&
instruction.get_code().get_bool(ID_WWfence) &&
instruction.get_code().get_bool(ID_RWfence) &&
instruction.get_code().get_bool(ID_RRfence));
instruction.code().get_statement() == ID_fence &&
instruction.code().get_bool(ID_WWfence) &&
instruction.code().get_bool(ID_RWfence) &&
instruction.code().get_bool(ID_RRfence));
}
17 changes: 8 additions & 9 deletions src/goto-instrument/wmm/goto2graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ void instrumentert::cfg_visitort::visit_cfg_function(
visit_cfg_skip(i_it);
}
else if(
instruction.is_other() &&
instruction.get_code().get_statement() == ID_fence)
instruction.is_other() && instruction.code().get_statement() == ID_fence)
{
visit_cfg_asm_fence(i_it, function_id);
}
Expand Down Expand Up @@ -792,13 +791,13 @@ void instrumentert::cfg_visitort::visit_cfg_asm_fence(
const irep_idt &function_id)
{
const goto_programt::instructiont &instruction=*i_it;
bool WRfence = instruction.get_code().get_bool(ID_WRfence);
bool WWfence = instruction.get_code().get_bool(ID_WWfence);
bool RRfence = instruction.get_code().get_bool(ID_RRfence);
bool RWfence = instruction.get_code().get_bool(ID_RWfence);
bool WWcumul = instruction.get_code().get_bool(ID_WWcumul);
bool RRcumul = instruction.get_code().get_bool(ID_RRcumul);
bool RWcumul = instruction.get_code().get_bool(ID_RWcumul);
bool WRfence = instruction.code().get_bool(ID_WRfence);
bool WWfence = instruction.code().get_bool(ID_WWfence);
bool RRfence = instruction.code().get_bool(ID_RRfence);
bool RWfence = instruction.code().get_bool(ID_RWfence);
bool WWcumul = instruction.code().get_bool(ID_WWcumul);
bool RRcumul = instruction.code().get_bool(ID_RRcumul);
bool RWcumul = instruction.code().get_bool(ID_RWcumul);
const abstract_eventt new_fence_event(
abstract_eventt::operationt::ASMfence,
thread,
Expand Down
16 changes: 8 additions & 8 deletions src/goto-instrument/wmm/shared_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void shared_bufferst::write(
target,
source_location,
vars.w_buff0,
original_instruction.get_code().op1());
original_instruction.code().op1());

// We update the used flags
assignment(
Expand Down Expand Up @@ -1219,7 +1219,7 @@ void shared_bufferst::cfg_visitort::weak_memory(
choice1_expr,
dereference_exprt{new_read_expr},
to_replace_expr),
to_replace_expr); // original_instruction.get_code().op1());
to_replace_expr); // original_instruction.code().op1());

shared_buffers.assignment(
goto_program,
Expand All @@ -1237,7 +1237,7 @@ void shared_bufferst::cfg_visitort::weak_memory(
i_it,
source_location,
w_entry.second.object,
original_instruction.get_code().op1());
original_instruction.code().op1());
}
}

Expand Down Expand Up @@ -1286,11 +1286,11 @@ void shared_bufferst::cfg_visitort::weak_memory(
else if(
is_fence(instruction, ns) ||
(instruction.is_other() &&
instruction.get_code().get_statement() == ID_fence &&
(instruction.get_code().get_bool("WRfence") ||
instruction.get_code().get_bool("WWfence") ||
instruction.get_code().get_bool("RWfence") ||
instruction.get_code().get_bool("RRfence"))))
instruction.code().get_statement() == ID_fence &&
(instruction.code().get_bool("WRfence") ||
instruction.code().get_bool("WWfence") ||
instruction.code().get_bool("RWfence") ||
instruction.code().get_bool("RRfence"))))
{
goto_programt::instructiont original_instruction;
original_instruction.swap(instruction);
Expand Down
14 changes: 7 additions & 7 deletions src/goto-programs/goto_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static void finish_catch_push_targets(goto_programt &dest)
{
if(
instruction.is_catch() &&
instruction.get_code().get_statement() == ID_push_catch)
instruction.code().get_statement() == ID_push_catch)
{
// Populate `targets` with a GOTO instruction target per
// exception handler if it isn't already populated.
Expand All @@ -71,7 +71,7 @@ static void finish_catch_push_targets(goto_programt &dest)
{
bool handler_added=true;
const code_push_catcht::exception_listt &handler_list =
to_code_push_catch(instruction.get_code()).exception_list();
to_code_push_catch(instruction.code()).exception_list();

for(const auto &handler : handler_list)
{
Expand Down Expand Up @@ -114,7 +114,7 @@ void goto_convertt::finish_gotos(goto_programt &dest, const irep_idt &mode)

if(i.is_start_thread())
{
const irep_idt &goto_label = i.get_code().get(ID_destination);
const irep_idt &goto_label = i.code().get(ID_destination);

labelst::const_iterator l_it=
targets.labels.find(goto_label);
Expand All @@ -123,22 +123,22 @@ void goto_convertt::finish_gotos(goto_programt &dest, const irep_idt &mode)
{
throw incorrect_goto_program_exceptiont(
"goto label \'" + id2string(goto_label) + "\' not found",
i.get_code().find_source_location());
i.code().find_source_location());
}

i.targets.push_back(l_it->second.first);
}
else if(i.is_incomplete_goto())
{
const irep_idt &goto_label = i.get_code().get(ID_destination);
const irep_idt &goto_label = i.code().get(ID_destination);

labelst::const_iterator l_it=targets.labels.find(goto_label);

if(l_it == targets.labels.end())
{
throw incorrect_goto_program_exceptiont(
"goto label \'" + id2string(goto_label) + "\' not found",
i.get_code().find_source_location());
i.code().find_source_location());
}

i.complete_goto(l_it->second.first);
Expand Down Expand Up @@ -204,7 +204,7 @@ void goto_convertt::finish_computed_gotos(goto_programt &goto_program)
for(auto &g_it : targets.computed_gotos)
{
goto_programt::instructiont &i=*g_it;
dereference_exprt destination = to_dereference_expr(i.get_code().op0());
dereference_exprt destination = to_dereference_expr(i.code().op0());
const exprt pointer = destination.pointer();

// remember the expression for later checks
Expand Down
Loading