@@ -107,7 +107,8 @@ class remove_exceptionst
107
107
}
108
108
109
109
void operator ()(goto_functionst &goto_functions);
110
- void operator ()(goto_programt &goto_program);
110
+ void
111
+ operator ()(const irep_idt &function_identifier, goto_programt &goto_program);
111
112
112
113
protected:
113
114
symbol_table_baset &symbol_table;
@@ -132,24 +133,28 @@ class remove_exceptionst
132
133
std::size_t &universal_catch);
133
134
134
135
void add_exception_dispatch_sequence (
136
+ const irep_idt &function_identifier,
135
137
goto_programt &goto_program,
136
138
const goto_programt::targett &instr_it,
137
139
const stack_catcht &stack_catch,
138
140
const std::vector<symbol_exprt> &locals);
139
141
140
142
bool instrument_throw (
143
+ const irep_idt &function_identifier,
141
144
goto_programt &goto_program,
142
145
const goto_programt::targett &,
143
146
const stack_catcht &,
144
147
const std::vector<symbol_exprt> &);
145
148
146
149
bool instrument_function_call (
150
+ const irep_idt &function_identifier,
147
151
goto_programt &goto_program,
148
152
const goto_programt::targett &,
149
153
const stack_catcht &,
150
154
const std::vector<symbol_exprt> &);
151
155
152
156
void instrument_exceptions (
157
+ const irep_idt &function_identifier,
153
158
goto_programt &goto_program);
154
159
};
155
160
@@ -299,12 +304,14 @@ goto_programt::targett remove_exceptionst::find_universal_exception(
299
304
// / if (exception instanceof ExnA) then goto handlerA
300
305
// / else if (exception instanceof ExnB) then goto handlerB
301
306
// / else goto universal_handler or (dead locals; function exit)
307
+ // / \param function_identifier: name of the function containing \p instr_it
302
308
// / \param goto_program: body of the function to which instr_it belongs
303
309
// / \param instr_it: throw or call instruction that may be an
304
310
// / exception source
305
311
// / \param stack_catch: exception handlers currently registered
306
312
// / \param locals: local variables to kill on a function-exit edge
307
313
void remove_exceptionst::add_exception_dispatch_sequence (
314
+ const irep_idt &function_identifier,
308
315
goto_programt &goto_program,
309
316
const goto_programt::targett &instr_it,
310
317
const remove_exceptionst::stack_catcht &stack_catch,
@@ -385,6 +392,7 @@ void remove_exceptionst::add_exception_dispatch_sequence(
385
392
// / instruments each throw with conditional GOTOS to the corresponding
386
393
// / exception handlers
387
394
bool remove_exceptionst::instrument_throw (
395
+ const irep_idt &function_identifier,
388
396
goto_programt &goto_program,
389
397
const goto_programt::targett &instr_it,
390
398
const remove_exceptionst::stack_catcht &stack_catch,
@@ -396,7 +404,7 @@ bool remove_exceptionst::instrument_throw(
396
404
uncaught_exceptions_domaint::get_exception_symbol (instr_it->code );
397
405
398
406
add_exception_dispatch_sequence (
399
- goto_program, instr_it, stack_catch, locals);
407
+ function_identifier, goto_program, instr_it, stack_catch, locals);
400
408
401
409
// find the symbol where the thrown exception should be stored:
402
410
symbol_exprt exc_thrown =
@@ -416,6 +424,7 @@ bool remove_exceptionst::instrument_throw(
416
424
// / instruments each function call that may escape exceptions with conditional
417
425
// / GOTOS to the corresponding exception handlers
418
426
bool remove_exceptionst::instrument_function_call (
427
+ const irep_idt &function_identifier,
419
428
goto_programt &goto_program,
420
429
const goto_programt::targett &instr_it,
421
430
const stack_catcht &stack_catch,
@@ -450,7 +459,7 @@ bool remove_exceptionst::instrument_function_call(
450
459
else
451
460
{
452
461
add_exception_dispatch_sequence (
453
- goto_program, instr_it, stack_catch, locals);
462
+ function_identifier, goto_program, instr_it, stack_catch, locals);
454
463
455
464
// add a null check (so that instanceof can be applied)
456
465
goto_programt::targett t_null=goto_program.insert_after (instr_it);
@@ -470,6 +479,7 @@ bool remove_exceptionst::instrument_function_call(
470
479
// / handlers. Additionally, it re-computes the live-range of local variables in
471
480
// / order to add DEAD instructions.
472
481
void remove_exceptionst::instrument_exceptions (
482
+ const irep_idt &function_identifier,
473
483
goto_programt &goto_program)
474
484
{
475
485
stack_catcht stack_catch; // stack of try-catch blocks
@@ -565,13 +575,13 @@ void remove_exceptionst::instrument_exceptions(
565
575
}
566
576
else if (instr_it->type ==THROW)
567
577
{
568
- did_something |=
569
- instrument_throw ( goto_program, instr_it, stack_catch, locals);
578
+ did_something |= instrument_throw (
579
+ function_identifier, goto_program, instr_it, stack_catch, locals);
570
580
}
571
581
else if (instr_it->type ==FUNCTION_CALL)
572
582
{
573
- did_something |=
574
- instrument_function_call ( goto_program, instr_it, stack_catch, locals);
583
+ did_something |= instrument_function_call (
584
+ function_identifier, goto_program, instr_it, stack_catch, locals);
575
585
}
576
586
}
577
587
@@ -582,12 +592,13 @@ void remove_exceptionst::instrument_exceptions(
582
592
void remove_exceptionst::operator ()(goto_functionst &goto_functions)
583
593
{
584
594
Forall_goto_functions (it, goto_functions)
585
- instrument_exceptions (it->second .body );
595
+ instrument_exceptions (it->first , it-> second .body );
586
596
}
587
597
588
- void remove_exceptionst::operator ()(goto_programt &goto_program)
598
+ void remove_exceptionst::
599
+ operator ()(const irep_idt &function_identifier, goto_programt &goto_program)
589
600
{
590
- instrument_exceptions (goto_program);
601
+ instrument_exceptions (function_identifier, goto_program);
591
602
}
592
603
593
604
// / removes throws/CATCH-POP/CATCH-PUSH
@@ -618,12 +629,14 @@ void remove_exceptions_using_instanceof(
618
629
// / because we can't inspect other functions to determine whether they throw
619
630
// / or not, and therefore must assume they do and always introduce post-call
620
631
// / exception dispatch.
632
+ // / \param function_identifier: name of the goto function being processed
621
633
// / \param goto_program: program to remove exceptions from
622
634
// / \param symbol_table: global symbol table. The `@inflight_exception` global
623
635
// / may be added if not already present. It will not be initialised; that is
624
636
// / the caller's responsibility.
625
637
// / \param message_handler: logging output
626
638
void remove_exceptions_using_instanceof (
639
+ const irep_idt &function_identifier,
627
640
goto_programt &goto_program,
628
641
symbol_table_baset &symbol_table,
629
642
message_handlert &message_handler)
@@ -634,7 +647,7 @@ void remove_exceptions_using_instanceof(
634
647
remove_exceptionst remove_exceptions (
635
648
symbol_table, nullptr , any_function_may_throw, false , message_handler);
636
649
637
- remove_exceptions (goto_program);
650
+ remove_exceptions (function_identifier, goto_program);
638
651
}
639
652
640
653
// / removes throws/CATCH-POP/CATCH-PUSH, replacing them with explicit exception
@@ -681,6 +694,7 @@ void remove_exceptions(
681
694
// / because we can't inspect other functions to determine whether they throw
682
695
// / or not, and therefore must assume they do and always introduce post-call
683
696
// / exception dispatch.
697
+ // / \param function_identifier: name of the goto function being processed
684
698
// / \param goto_program: program to remove exceptions from
685
699
// / \param symbol_table: global symbol table. The `@inflight_exception` global
686
700
// / may be added if not already present. It will not be initialised; that is
@@ -689,6 +703,7 @@ void remove_exceptions(
689
703
// / Only needed if type == REMOVE_ADDED_INSTANCEOF; otherwise may be null.
690
704
// / \param message_handler: logging output
691
705
void remove_exceptions (
706
+ const irep_idt &function_identifier,
692
707
goto_programt &goto_program,
693
708
symbol_table_baset &symbol_table,
694
709
const class_hierarchyt &class_hierarchy,
@@ -704,7 +719,7 @@ void remove_exceptions(
704
719
true ,
705
720
message_handler);
706
721
707
- remove_exceptions (goto_program);
722
+ remove_exceptions (function_identifier, goto_program);
708
723
}
709
724
710
725
// / removes throws/CATCH-POP/CATCH-PUSH, replacing them with explicit exception
0 commit comments