Skip to content

Commit 548f19a

Browse files
author
Daniel Kroening
committed
Store identifiers of parameters in goto_functiont::parameter_identifiers
This is to enable a transition towards #4167.
1 parent a4aaaf5 commit 548f19a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/goto-programs/goto_convert_functions.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ void goto_convert_functionst::convert_function(
153153

154154
f.type=to_code_type(symbol.type);
155155

156+
// store the parameter identifiers in the goto functions
157+
const code_typet &code_type = to_code_type(symbol.type);
158+
f.parameter_identifiers.clear();
159+
f.parameter_identifiers.reserve(code_type.parameters().size());
160+
for(const auto &parameter : code_type.parameters())
161+
f.parameter_identifiers.push_back(parameter.get_identifier());
162+
156163
if(symbol.value.is_nil() ||
157164
symbol.is_compiled()) /* goto_inline may have removed the body */
158165
return;

src/goto-programs/goto_function.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,35 @@ class goto_functiont
2929
goto_programt body;
3030

3131
/// The type of the function, indicating the return type and parameter types
32+
/// This is deprecated; get the type from the namespace instead.
3233
code_typet type;
3334

3435
typedef std::vector<irep_idt> parameter_identifierst;
3536

3637
/// The identifiers of the parameters of this function
3738
///
38-
/// Note: This variable is currently unused and the vector is thus always
39-
/// empty. In the future the code base may be refactored to fill in the
40-
/// parameter identifiers here when creating a `goto_functiont`. For now the
41-
/// parameter identifiers should be retrieved from the type (`code_typet`).
39+
/// Note: This is now the preferred way of getting the identifiers of the
40+
/// parameters. The identifiers in the type will go away.
4241
parameter_identifierst parameter_identifiers;
4342

4443
bool body_available() const
4544
{
4645
return !body.instructions.empty();
4746
}
4847

48+
/// This is deprecated; get the type from the namespace instead.
4949
bool is_inlined() const
5050
{
5151
return type.get_bool(ID_C_inlined);
5252
}
5353

54+
/// This is deprecated; get the type from the namespace instead.
5455
bool is_hidden() const
5556
{
5657
return type.get_bool(ID_C_hide);
5758
}
5859

60+
/// This is deprecated; modify the type in the namespace instead.
5961
void make_hidden()
6062
{
6163
type.set(ID_C_hide, true);

0 commit comments

Comments
 (0)