Skip to content

Commit ce41ade

Browse files
author
thk123
committed
Tidying changes in ci_lazy_methods
Use a typedef for the function accepted for loading more methods. Corrected doxy comments in ci_lazy_methods
1 parent d75570c commit ce41ade

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/java_bytecode/ci_lazy_methods.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,12 @@ ci_lazy_methodst::ci_lazy_methodst(
4848
/// \param symbol_table: global symbol table
4949
/// \param [out] lazy_methods: map from method names to relevant symbol and
5050
/// parsed-method objects.
51+
/// \param method_converter: Function for converting methods on demand.
5152
/// \return Returns false on success
5253
bool ci_lazy_methodst::operator()(
5354
symbol_tablet &symbol_table,
5455
lazy_methodst &lazy_methods,
55-
std::function<void(
56-
const symbolt &,
57-
const java_bytecode_parse_treet::methodt &,
58-
ci_lazy_methods_neededt)> method_converter)
56+
method_convertert method_converter)
5957
{
6058
std::vector<irep_idt> method_worklist1;
6159
std::vector<irep_idt> method_worklist2;
@@ -117,7 +115,7 @@ bool ci_lazy_methodst::operator()(
117115
std::set<irep_idt> methods_already_populated;
118116
std::vector<const code_function_callt *> virtual_callsites;
119117

120-
bool any_new_methods;
118+
bool any_new_methods=false;
121119
do
122120
{
123121
any_new_methods=false;
@@ -251,9 +249,6 @@ void ci_lazy_methodst::resolve_method_names(
251249
/// \param entry_points: list of fully-qualified function names that
252250
/// we should assume are reachable
253251
/// \param ns: global namespace
254-
/// \param ch: global class hierarchy
255-
/// \param pointer_type_selector: The pointer_type_selector used to find out
256-
/// what other classes may be used for pointers
257252
/// \param [out] lazy_methods: Populated with all Java reference types whose
258253
/// references may be passed, directly or indirectly, to any of the functions
259254
/// in `entry_points`.
@@ -289,7 +284,6 @@ void ci_lazy_methodst::initialize_needed_classes(
289284
/// `initialize_needed_classes` for more details.
290285
/// \param pointer_type: The type to gather methods for.
291286
/// \param ns: global namespace
292-
/// \param ch: global class hierarchy
293287
/// \param [out] lazy_methods: Populated with all Java reference types whose
294288
/// references may be passed, directly or indirectly, to any of the functions
295289
/// in `entry_points
@@ -308,7 +302,7 @@ void ci_lazy_methodst::initialize_needed_classes_from_pointer(
308302

309303
/// Get places where virtual functions are called.
310304
/// \param e: expression tree to search
311-
/// \param [out] results: filled with pointers to each function call within
305+
/// \param [out] result: filled with pointers to each function call within
312306
/// e that calls a virtual function.
313307
void ci_lazy_methodst::gather_virtual_callsites(
314308
const exprt &e,
@@ -367,10 +361,10 @@ void ci_lazy_methodst::get_virtual_method_targets(
367361
needed_methods.push_back(self_method);
368362
}
369363

370-
auto child_classes=class_hierarchy.get_children_trans(call_class);
364+
const auto child_classes=class_hierarchy.get_children_trans(call_class);
371365
for(const auto &child_class : child_classes)
372366
{
373-
auto child_method=
367+
const auto child_method=
374368
get_virtual_method_target(
375369
needed_classes,
376370
call_basename,
@@ -410,7 +404,8 @@ void ci_lazy_methodst::gather_needed_globals(
410404
// on an opaque type (i.e. we don't have the class definition at this point)
411405
// and will be created during the typecheck phase.
412406
// We don't mark it as 'needed' as it doesn't exist yet to keep.
413-
auto findit=symbol_table.symbols.find(to_symbol_expr(e).get_identifier());
407+
const auto findit=
408+
symbol_table.symbols.find(to_symbol_expr(e).get_identifier());
414409
if(findit!=symbol_table.symbols.end() &&
415410
findit->second.is_static_lifetime)
416411
{

src/java_bytecode/ci_lazy_methods.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ typedef std::pair<
3333
typedef std::map<irep_idt, lazy_method_valuet>
3434
lazy_methodst;
3535

36+
typedef std::function<void(
37+
const symbolt &,
38+
const java_bytecode_parse_treet::methodt &,
39+
ci_lazy_methods_neededt)> method_convertert;
40+
3641
class ci_lazy_methodst:public messaget
3742
{
3843
public:
@@ -48,10 +53,7 @@ class ci_lazy_methodst:public messaget
4853
bool operator()(
4954
symbol_tablet &symbol_table,
5055
lazy_methodst &lazy_methods,
51-
std::function<void(
52-
const symbolt &,
53-
const java_bytecode_parse_treet::methodt &,
54-
ci_lazy_methods_neededt)> method_converter);
56+
method_convertert method_converter);
5557

5658
private:
5759
void resolve_method_names(

0 commit comments

Comments
 (0)