Skip to content

Prepare DECL/DEAD construction with location #6420

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

Closed
Closed
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
10 changes: 10 additions & 0 deletions src/goto-programs/goto_instruction_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ class code_deadt : public codet
{
}

code_deadt(symbol_exprt symbol, source_locationt loc)
: codet(ID_dead, {std::move(symbol)}, std::move(loc))
{
}

symbol_exprt &symbol()
{
return static_cast<symbol_exprt &>(op0());
Expand Down Expand Up @@ -201,6 +206,11 @@ class code_declt : public codet
{
}

code_declt(symbol_exprt symbol, source_locationt loc)
: codet(ID_decl, {std::move(symbol)}, std::move(loc))
{
}

symbol_exprt &symbol()
{
return static_cast<symbol_exprt &>(op0());
Expand Down
21 changes: 14 additions & 7 deletions src/goto-programs/goto_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,27 @@ class goto_programt
return instructiont(_code, l, OTHER, nil_exprt(), {});
}

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

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

static instructiont make_dead(
const code_deadt &_code,
const source_locationt &l = source_locationt::nil())
{
return instructiont(_code, l, DEAD, nil_exprt(), {});
}

static instructiont make_dead(
const symbol_exprt &symbol,
const source_locationt &l = source_locationt::nil())
Expand Down Expand Up @@ -1047,13 +1061,6 @@ class goto_programt
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,
Expand Down