Skip to content

Commit 9cc0411

Browse files
author
Daniel Kroening
committed
more typing for do_function_call
1 parent 6429042 commit 9cc0411

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,15 +1000,15 @@ Function: goto_convertt::do_function_call_symbol
10001000

10011001
void goto_convertt::do_function_call_symbol(
10021002
const exprt &lhs,
1003-
const exprt &function,
1003+
const symbol_exprt &function,
10041004
const exprt::operandst &arguments,
10051005
goto_programt &dest)
10061006
{
10071007
if(function.get_bool("#invalid_object"))
10081008
return; // ignore
10091009

10101010
// lookup symbol
1011-
const irep_idt &identifier=function.get(ID_identifier);
1011+
const irep_idt &identifier=function.get_identifier();
10121012

10131013
const symbolt *symbol;
10141014
if(ns.lookup(identifier, symbol))

src/goto-programs/goto_convert_class.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ class goto_convertt:public message_streamt
143143

144144
virtual void do_function_call_if(
145145
const exprt &lhs,
146-
const exprt &function,
146+
const if_exprt &function,
147147
const exprt::operandst &arguments,
148148
goto_programt &dest);
149149

150150
virtual void do_function_call_symbol(
151151
const exprt &lhs,
152-
const exprt &function,
152+
const symbol_exprt &function,
153153
const exprt::operandst &arguments,
154154
goto_programt &dest);
155155

src/goto-programs/goto_convert_function_call.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ void goto_convertt::do_function_call(
9191
}
9292
else if(new_function.id()==ID_if)
9393
{
94-
do_function_call_if(new_lhs, new_function, new_arguments, dest);
94+
do_function_call_if(new_lhs, to_if_expr(new_function), new_arguments, dest);
9595
}
9696
else if(new_function.id()==ID_symbol)
9797
{
98-
do_function_call_symbol(new_lhs, new_function, new_arguments, dest);
98+
do_function_call_symbol(new_lhs, to_symbol_expr(new_function), new_arguments, dest);
9999
}
100100
else if(new_function.id()=="NULL-object")
101101
{
@@ -121,16 +121,10 @@ Function: goto_convertt::do_function_call_if
121121

122122
void goto_convertt::do_function_call_if(
123123
const exprt &lhs,
124-
const exprt &function,
124+
const if_exprt &function,
125125
const exprt::operandst &arguments,
126126
goto_programt &dest)
127127
{
128-
if(function.operands().size()!=3)
129-
{
130-
err_location(function);
131-
throw "if expects three operands";
132-
}
133-
134128
// case split
135129

136130
// c?f():g()
@@ -158,7 +152,7 @@ void goto_convertt::do_function_call_if(
158152
goto_programt tmp_y;
159153
goto_programt::targett y;
160154

161-
do_function_call(lhs, function.op2(), arguments, tmp_y);
155+
do_function_call(lhs, function.false_case(), arguments, tmp_y);
162156

163157
if(tmp_y.instructions.empty())
164158
y=tmp_y.add_instruction(SKIP);
@@ -167,14 +161,14 @@ void goto_convertt::do_function_call_if(
167161

168162
// v: if(!c) goto y;
169163
v->make_goto(y);
170-
v->guard=function.op0();
164+
v->guard=function.cond();
171165
v->guard.make_not();
172-
v->source_location=function.op0().source_location();
166+
v->source_location=function.cond().source_location();
173167

174168
// w: f();
175169
goto_programt tmp_w;
176170

177-
do_function_call(lhs, function.op1(), arguments, tmp_w);
171+
do_function_call(lhs, function.true_case(), arguments, tmp_w);
178172

179173
if(tmp_w.instructions.empty())
180174
tmp_w.add_instruction(SKIP);

0 commit comments

Comments
 (0)