File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -988,21 +988,21 @@ code_blockt stub_global_initializer_factoryt::get_stub_initializer_body(
988
988
// class. Note this is the same invocation used in
989
989
// java_static_lifetime_init.
990
990
991
- auto class_globals = stub_globals_by_class. equal_range (*class_id);
991
+ auto class_globals = equal_range (stub_globals_by_class, *class_id);
992
992
INVARIANT (
993
- class_globals. first != class_globals.second ,
993
+ ! class_globals.empty () ,
994
994
" class with synthetic clinit should have at least one global to init" );
995
995
996
996
java_object_factory_parameterst parameters = object_factory_parameters;
997
997
parameters.function_id = function_id;
998
998
999
- for (auto it = class_globals. first ; it != class_globals. second ; ++it )
999
+ for (const auto &pair : class_globals)
1000
1000
{
1001
1001
const symbol_exprt new_global_symbol =
1002
- symbol_table.lookup_ref (it-> second ).symbol_expr ();
1002
+ symbol_table.lookup_ref (pair. second ).symbol_expr ();
1003
1003
1004
1004
parameters.min_null_tree_depth =
1005
- is_non_null_library_global (it-> second )
1005
+ is_non_null_library_global (pair. second )
1006
1006
? object_factory_parameters.min_null_tree_depth + 1
1007
1007
: object_factory_parameters.min_null_tree_depth ;
1008
1008
Original file line number Diff line number Diff line change @@ -533,4 +533,15 @@ auto make_range(containert &container) -> ranget<decltype(container.begin())>
533
533
container.begin (), container.end ());
534
534
}
535
535
536
+ // / Utility function to make equal_range method of multimap easier to use by
537
+ // / returning a ranget object. For instance, we can write:
538
+ // / `for(auto value : equal_range(map, key).filter(...).map(...)) {...}`.
539
+ template <typename multimapt>
540
+ ranget<typename multimapt::const_iterator>
541
+ equal_range (const multimapt &multimap, const typename multimapt::key_type &key)
542
+ {
543
+ auto iterator_pair = multimap.equal_range (key);
544
+ return make_range (iterator_pair.first , iterator_pair.second );
545
+ }
546
+
536
547
#endif // CPROVER_UTIL_RANGE_H
You can’t perform that action at this time.
0 commit comments