Skip to content

Commit c11bba0

Browse files
committed
Style fixes
No functional changes intended.
1 parent 5d534eb commit c11bba0

File tree

5 files changed

+29
-35
lines changed

5 files changed

+29
-35
lines changed

src/goto-programs/goto_program.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ std::ostream &goto_programt::output_instruction(
178178
for(instructiont::targetst::const_iterator
179179
gt_it=instruction.targets.begin();
180180
gt_it!=instruction.targets.end();
181-
gt_it++,
182-
i++)
181+
gt_it++, i++)
183182
{
184183
if(gt_it!=instruction.targets.begin())
185184
out << ", ";
@@ -193,7 +192,7 @@ std::ostream &goto_programt::output_instruction(
193192
}
194193
else
195194
{
196-
out << "! unexpected CATCH opcode " << instruction.code.get_statement();
195+
UNREACHABLE;
197196
}
198197

199198
out << '\n';

src/goto-programs/remove_exceptions.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ class remove_exceptionst
5454

5555
void instrument_exception_handler(
5656
const goto_functionst::function_mapt::iterator &,
57-
const goto_programt::instructionst::iterator &);
57+
const goto_programt::targett &);
5858

5959
void add_exception_dispatch_sequence(
6060
const goto_functionst::function_mapt::iterator &,
61-
const goto_programt::instructionst::iterator &instr_it,
61+
const goto_programt::targett &instr_it,
6262
const stack_catcht &stack_catch,
6363
const std::vector<exprt> &locals);
6464

6565
void instrument_throw(
6666
const goto_functionst::function_mapt::iterator &,
67-
const goto_programt::instructionst::iterator &,
67+
const goto_programt::targett &,
6868
const stack_catcht &,
6969
const std::vector<exprt> &);
7070

7171
void instrument_function_call(
7272
const goto_functionst::function_mapt::iterator &,
73-
const goto_programt::instructionst::iterator &,
73+
const goto_programt::targett &,
7474
const stack_catcht &,
7575
const std::vector<exprt> &);
7676

@@ -188,14 +188,14 @@ void remove_exceptionst::add_exceptional_returns(
188188

189189
/// Translates an exception landing-pad into instructions that copy the
190190
/// in-flight exception pointer to a nominated expression, then clear the
191-
/// in-flight exception, hence marking it caught.
191+
/// in-flight exception (i.e. null the pointer), hence marking it caught.
192192
/// \param func_it: iterator pointing to the function containing this
193193
/// landingpad instruction
194194
/// \param instr_it [in, out]: iterator pointing to the landingpad instruction.
195195
/// Will be overwritten.
196196
void remove_exceptionst::instrument_exception_handler(
197197
const goto_functionst::function_mapt::iterator &func_it,
198-
const goto_programt::instructionst::iterator &instr_it)
198+
const goto_programt::targett &instr_it)
199199
{
200200
const irep_idt &function_id=func_it->first;
201201
goto_programt &goto_program=func_it->second.body;
@@ -236,8 +236,8 @@ void remove_exceptionst::instrument_exception_handler(
236236
}
237237

238238
/// Emit the code:
239-
/// if (exception instanceof ExnA) then goto handlera
240-
/// else if (exception instanceof ExnB) then goto handlerb
239+
/// if (exception instanceof ExnA) then goto handlerA
240+
/// else if (exception instanceof ExnB) then goto handlerB
241241
/// else goto universal_handler or (dead locals; function exit)
242242
/// \param function_id: function instr_it belongs to
243243
/// \param instr_it: throw or call instruction that may be an
@@ -246,7 +246,7 @@ void remove_exceptionst::instrument_exception_handler(
246246
/// \param locals: local variables to kill on a function-exit edge
247247
void remove_exceptionst::add_exception_dispatch_sequence(
248248
const goto_functionst::function_mapt::iterator &func_it,
249-
const goto_programt::instructionst::iterator &instr_it,
249+
const goto_programt::targett &instr_it,
250250
const remove_exceptionst::stack_catcht &stack_catch,
251251
const std::vector<exprt> &locals)
252252
{
@@ -266,7 +266,7 @@ void remove_exceptionst::add_exception_dispatch_sequence(
266266

267267
// find the symbol corresponding to the caught exceptions
268268
const symbolt &exc_symbol=
269-
symbol_table.lookup(id2string(function_id)+EXC_SUFFIX);
269+
symbol_table.lookup(id2string(function_id)+EXC_SUFFIX);
270270
symbol_exprt exc_thrown=exc_symbol.symbol_expr();
271271

272272
// add GOTOs implementing the dynamic dispatch of the
@@ -277,7 +277,7 @@ void remove_exceptionst::add_exception_dispatch_sequence(
277277
{
278278
goto_programt::targett new_state_pc=
279279
stack_catch[i][j].second;
280-
if(stack_catch[i][j].first==irep_idt())
280+
if(stack_catch[i][j].first.empty())
281281
{
282282
// Universal handler. Highest on the stack takes
283283
// precedence, so overwrite any we've already seen:
@@ -318,7 +318,7 @@ void remove_exceptionst::add_exception_dispatch_sequence(
318318
/// exception handlers
319319
void remove_exceptionst::instrument_throw(
320320
const goto_functionst::function_mapt::iterator &func_it,
321-
const goto_programt::instructionst::iterator &instr_it,
321+
const goto_programt::targett &instr_it,
322322
const remove_exceptionst::stack_catcht &stack_catch,
323323
const std::vector<exprt> &locals)
324324
{
@@ -356,7 +356,7 @@ void remove_exceptionst::instrument_throw(
356356
/// GOTOS to the corresponding exception handlers
357357
void remove_exceptionst::instrument_function_call(
358358
const goto_functionst::function_mapt::iterator &func_it,
359-
const goto_programt::instructionst::iterator &instr_it,
359+
const goto_programt::targett &instr_it,
360360
const stack_catcht &stack_catch,
361361
const std::vector<exprt> &locals)
362362
{
@@ -366,7 +366,7 @@ void remove_exceptionst::instrument_function_call(
366366
const irep_idt &function_id=func_it->first;
367367

368368
// save the address of the next instruction
369-
goto_programt::instructionst::iterator next_it=instr_it;
369+
goto_programt::targett next_it=instr_it;
370370
next_it++;
371371

372372
code_function_callt &function_call=to_code_function_call(instr_it->code);
@@ -481,7 +481,7 @@ void remove_exceptionst::instrument_exceptions(
481481
// the targets were unreachable (in which case no exception can truly
482482
// be thrown at runtime)
483483
INVARIANT(
484-
instr_it->targets.size()==0 ||
484+
instr_it->targets.empty() ||
485485
exception_list.size()==instr_it->targets.size(),
486486
"`exception_list` should contain current instruction's targets");
487487

src/java_bytecode/expr2java.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,10 @@ std::string expr2javat::convert_with_precedence(
397397
{
398398
const exprt &catch_expr=
399399
to_code_landingpad(to_code(src)).catch_expr();
400-
return "catch_landingpad(" +
401-
convert(catch_expr.type()) +
402-
' ' +
403-
convert(catch_expr) +
400+
return "catch_landingpad("+
401+
convert(catch_expr.type())+
402+
' '+
403+
convert(catch_expr)+
404404
')';
405405
}
406406
else if(src.id()==ID_unassigned)

src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,10 @@ codet java_bytecode_convert_methodt::convert_instructions(
12171217
if(cur_pc==it->handler_pc)
12181218
{
12191219
if(catch_type!=typet() || it->catch_type==symbol_typet())
1220+
{
12201221
catch_type=symbol_typet("java::java.lang.Throwable");
1222+
break;
1223+
}
12211224
else
12221225
catch_type=it->catch_type;
12231226
}

src/util/std_code.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,17 +1229,13 @@ class code_push_catcht:public codet
12291229
}
12301230
};
12311231

1232-
static inline code_push_catcht &
1233-
to_code_push_catch(
1234-
codet &code)
1232+
static inline code_push_catcht &to_code_push_catch(codet &code)
12351233
{
12361234
assert(code.get_statement()==ID_push_catch);
12371235
return static_cast<code_push_catcht &>(code);
12381236
}
12391237

1240-
static inline const code_push_catcht &
1241-
to_code_push_catch(
1242-
const codet &code)
1238+
static inline const code_push_catcht &to_code_push_catch(const codet &code)
12431239
{
12441240
assert(code.get_statement()==ID_push_catch);
12451241
return static_cast<const code_push_catcht &>(code);
@@ -1256,15 +1252,13 @@ class code_pop_catcht:public codet
12561252
}
12571253
};
12581254

1259-
static inline code_pop_catcht &to_code_pop_catch(
1260-
codet &code)
1255+
static inline code_pop_catcht &to_code_pop_catch(codet &code)
12611256
{
12621257
assert(code.get_statement()==ID_pop_catch);
12631258
return static_cast<code_pop_catcht &>(code);
12641259
}
12651260

1266-
static inline const code_pop_catcht &to_code_pop_catch(
1267-
const codet &code)
1261+
static inline const code_pop_catcht &to_code_pop_catch(const codet &code)
12681262
{
12691263
assert(code.get_statement()==ID_pop_catch);
12701264
return static_cast<const code_pop_catcht &>(code);
@@ -1301,9 +1295,7 @@ static inline code_landingpadt &to_code_landingpad(codet &code)
13011295
return static_cast<code_landingpadt &>(code);
13021296
}
13031297

1304-
static inline const code_landingpadt &
1305-
to_code_landingpad(
1306-
const codet &code)
1298+
static inline const code_landingpadt &to_code_landingpad(const codet &code)
13071299
{
13081300
assert(code.get_statement()==ID_exception_landingpad);
13091301
return static_cast<const code_landingpadt &>(code);

0 commit comments

Comments
 (0)