Skip to content

extend make_assignment and make_function_call APIs #4179

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
Feb 13, 2019
Merged
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
26 changes: 26 additions & 0 deletions src/goto-programs/goto_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -945,26 +945,52 @@ class goto_programt
{_target});
}

/// Create an assignment instruction
static instructiont make_assignment(
const code_assignt &_code,
const source_locationt &l = source_locationt::nil())
{
return instructiont(_code, l, ASSIGN, nil_exprt(), {});
}

/// Create an assignment instruction
static instructiont make_assignment(
exprt lhs,
exprt rhs,
const source_locationt &l = source_locationt::nil())
{
return instructiont(
code_assignt(std::move(lhs), std::move(rhs)), l, ASSIGN, nil_exprt(), {});
}

static instructiont make_decl(
const code_declt &_code,
const source_locationt &l = source_locationt::nil())
{
return instructiont(_code, l, DECL, nil_exprt(), {});
}

/// Create a function call instruction
static instructiont make_function_call(
const code_function_callt &_code,
const source_locationt &l = source_locationt::nil())
{
return instructiont(_code, l, FUNCTION_CALL, nil_exprt(), {});
}

/// Create a function call instruction
static instructiont make_function_call(
exprt function,
code_function_callt::argumentst arguments,
const source_locationt &l = source_locationt::nil())
{
return instructiont(
code_function_callt(std::move(function), std::move(arguments)),
l,
FUNCTION_CALL,
nil_exprt(),
{});
}
};

/// Get control-flow successors of a given instruction. The instruction is
Expand Down