Skip to content

Commit d48e840

Browse files
authored
Merge pull request #4179 from diffblue/extend_make_X_API
extend make_assignment and make_function_call APIs
2 parents f77bca3 + defc456 commit d48e840

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/goto-programs/goto_program.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,26 +959,52 @@ class goto_programt
959959
{_target});
960960
}
961961

962+
/// Create an assignment instruction
962963
static instructiont make_assignment(
963964
const code_assignt &_code,
964965
const source_locationt &l = source_locationt::nil())
965966
{
966967
return instructiont(_code, l, ASSIGN, nil_exprt(), {});
967968
}
968969

970+
/// Create an assignment instruction
971+
static instructiont make_assignment(
972+
exprt lhs,
973+
exprt rhs,
974+
const source_locationt &l = source_locationt::nil())
975+
{
976+
return instructiont(
977+
code_assignt(std::move(lhs), std::move(rhs)), l, ASSIGN, nil_exprt(), {});
978+
}
979+
969980
static instructiont make_decl(
970981
const code_declt &_code,
971982
const source_locationt &l = source_locationt::nil())
972983
{
973984
return instructiont(_code, l, DECL, nil_exprt(), {});
974985
}
975986

987+
/// Create a function call instruction
976988
static instructiont make_function_call(
977989
const code_function_callt &_code,
978990
const source_locationt &l = source_locationt::nil())
979991
{
980992
return instructiont(_code, l, FUNCTION_CALL, nil_exprt(), {});
981993
}
994+
995+
/// Create a function call instruction
996+
static instructiont make_function_call(
997+
exprt function,
998+
code_function_callt::argumentst arguments,
999+
const source_locationt &l = source_locationt::nil())
1000+
{
1001+
return instructiont(
1002+
code_function_callt(std::move(function), std::move(arguments)),
1003+
l,
1004+
FUNCTION_CALL,
1005+
nil_exprt(),
1006+
{});
1007+
}
9821008
};
9831009

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

0 commit comments

Comments
 (0)