Skip to content

Commit caf6efa

Browse files
committed
Change formatting of goto_convert_functions
Changes the formatting of goto_convert_functions.cpp according to clang-format.
1 parent 95749f8 commit caf6efa

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

src/goto-programs/goto_convert_functions.cpp

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Date: June 2003
2222

2323
goto_convert_functionst::goto_convert_functionst(
2424
symbol_table_baset &_symbol_table,
25-
message_handlert &_message_handler):
26-
goto_convertt(_symbol_table, _message_handler)
25+
message_handlert &_message_handler)
26+
: goto_convertt(_symbol_table, _message_handler)
2727
{
2828
}
2929

@@ -59,8 +59,8 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
5959

6060
functions.compute_location_numbers();
6161

62-
// this removes the parse tree of the bodies from memory
63-
#if 0
62+
// this removes the parse tree of the bodies from memory
63+
#if 0
6464
for(const auto &symbol_pair, symbol_table.symbols)
6565
{
6666
if(!symbol_pair.second.is_type &&
@@ -70,7 +70,7 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
7070
symbol_pair.second.value=codet();
7171
}
7272
}
73-
#endif
73+
#endif
7474
}
7575

7676
bool goto_convert_functionst::hide(const goto_programt &goto_program)
@@ -89,7 +89,7 @@ void goto_convert_functionst::add_return(
8989
goto_functionst::goto_functiont &f,
9090
const source_locationt &source_location)
9191
{
92-
#if 0
92+
#if 0
9393
if(!f.body.instructions.empty() &&
9494
f.body.instructions.back().is_return())
9595
return; // not needed, we have one already
@@ -99,12 +99,11 @@ void goto_convert_functionst::add_return(
9999
f.body.instructions.back().is_goto() &&
100100
f.body.instructions.back().guard.is_true())
101101
return;
102-
#else
102+
#else
103103

104104
if(!f.body.instructions.empty())
105105
{
106-
goto_programt::const_targett last_instruction=
107-
f.body.instructions.end();
106+
goto_programt::const_targett last_instruction = f.body.instructions.end();
108107
last_instruction--;
109108

110109
while(true)
@@ -122,16 +121,17 @@ void goto_convert_functionst::add_return(
122121
return;
123122

124123
// advance if it's a 'dead' without branch target
125-
if(last_instruction->is_dead() &&
126-
last_instruction!=f.body.instructions.begin() &&
127-
!last_instruction->is_target())
124+
if(
125+
last_instruction->is_dead() &&
126+
last_instruction != f.body.instructions.begin() &&
127+
!last_instruction->is_target())
128128
last_instruction--;
129129
else
130130
break; // give up
131131
}
132132
}
133133

134-
#endif
134+
#endif
135135

136136
side_effect_expr_nondett rhs(f.type.return_type(), source_location);
137137

@@ -143,22 +143,23 @@ void goto_convert_functionst::convert_function(
143143
const irep_idt &identifier,
144144
goto_functionst::goto_functiont &f)
145145
{
146-
const symbolt &symbol=ns.lookup(identifier);
146+
const symbolt &symbol = ns.lookup(identifier);
147147
const irep_idt mode = symbol.mode;
148148

149149
if(f.body_available())
150150
return; // already converted
151151

152152
// make tmp variables local to function
153-
tmp_symbol_prefix=id2string(symbol.name)+"::$tmp";
153+
tmp_symbol_prefix = id2string(symbol.name) + "::$tmp";
154154

155155
// store the parameter identifiers in the goto functions
156156
const code_typet &code_type = to_code_type(symbol.type);
157157
f.type = code_type;
158158
f.set_parameter_identifiers(code_type);
159159

160-
if(symbol.value.is_nil() ||
161-
symbol.is_compiled()) /* goto_inline may have removed the body */
160+
if(
161+
symbol.value.is_nil() ||
162+
symbol.is_compiled()) /* goto_inline may have removed the body */
162163
return;
163164

164165
// we have a body, make sure all parameter names are valid
@@ -174,25 +175,24 @@ void goto_convert_functionst::convert_function(
174175
lifetime = identifier == INITIALIZE_FUNCTION ? lifetimet::STATIC_GLOBAL
175176
: lifetimet::AUTOMATIC_LOCAL;
176177

177-
const codet &code=to_code(symbol.value);
178+
const codet &code = to_code(symbol.value);
178179

179180
source_locationt end_location;
180181

181-
if(code.get_statement()==ID_block)
182-
end_location=to_code_block(code).end_location();
182+
if(code.get_statement() == ID_block)
183+
end_location = to_code_block(code).end_location();
183184
else
184185
end_location.make_nil();
185186

186187
goto_programt tmp_end_function;
187188
goto_programt::targett end_function =
188189
tmp_end_function.add(goto_programt::make_end_function(end_location));
189190

190-
targets=targetst();
191+
targets = targetst();
191192
targets.set_return(end_function);
192-
targets.has_return_value=
193-
f.type.return_type().id()!=ID_empty &&
194-
f.type.return_type().id()!=ID_constructor &&
195-
f.type.return_type().id()!=ID_destructor;
193+
targets.has_return_value = f.type.return_type().id() != ID_empty &&
194+
f.type.return_type().id() != ID_constructor &&
195+
f.type.return_type().id() != ID_destructor;
196196

197197
goto_convert_rec(code, f.body, mode);
198198

@@ -201,12 +201,13 @@ void goto_convert_functionst::convert_function(
201201
add_return(f, end_location);
202202

203203
// handle SV-COMP's __VERIFIER_atomic_
204-
if(!f.body.instructions.empty() &&
205-
has_prefix(id2string(identifier), "__VERIFIER_atomic_"))
204+
if(
205+
!f.body.instructions.empty() &&
206+
has_prefix(id2string(identifier), "__VERIFIER_atomic_"))
206207
{
207208
goto_programt::instructiont a_begin;
208209
a_begin = goto_programt::make_atomic_begin();
209-
a_begin.source_location=f.body.instructions.front().source_location;
210+
a_begin.source_location = f.body.instructions.front().source_location;
210211
f.body.insert_before_swap(f.body.instructions.begin(), a_begin);
211212

212213
goto_programt::targett a_end =
@@ -233,9 +234,7 @@ void goto_convert_functionst::convert_function(
233234
lifetime = parent_lifetime;
234235
}
235236

236-
void goto_convert(
237-
goto_modelt &goto_model,
238-
message_handlert &message_handler)
237+
void goto_convert(goto_modelt &goto_model, message_handlert &message_handler)
239238
{
240239
symbol_table_buildert symbol_table_builder =
241240
symbol_table_buildert::wrap(goto_model.symbol_table);

0 commit comments

Comments
 (0)