diff --git a/.clang-format b/.clang-format index 42c84c215aa..be99f756baa 100644 --- a/.clang-format +++ b/.clang-format @@ -30,8 +30,6 @@ DerivePointerAlignment: 'false' DisableFormat: 'false' ExperimentalAutoDetectBinPacking: 'false' ForEachMacros: [ - 'forall_rw_range_set_r_objects', - 'forall_rw_range_set_w_objects', 'forall_rw_set_r_entries', 'forall_rw_set_w_entries', 'forall_goto_functions', diff --git a/src/analyses/dependence_graph.cpp b/src/analyses/dependence_graph.cpp index f06eff8c062..6f30ea87ae0 100644 --- a/src/analyses/dependence_graph.cpp +++ b/src/analyses/dependence_graph.cpp @@ -161,11 +161,11 @@ void dep_graph_domaint::data_dependencies( rw_range_set_value_sett rw_set(ns, value_sets); goto_rw(function_to, to, rw_set); - forall_rw_range_set_r_objects(it, rw_set) + for(const auto &read_object_entry : rw_set.get_r_set()) { - const range_domaint &r_ranges=rw_set.get_ranges(it); - const rd_range_domaint::ranges_at_loct &w_ranges= - dep_graph.reaching_definitions()[to].get(it->first); + const range_domaint &r_ranges = rw_set.get_ranges(read_object_entry.second); + const rd_range_domaint::ranges_at_loct &w_ranges = + dep_graph.reaching_definitions()[to].get(read_object_entry.first); for(const auto &w_range : w_ranges) { @@ -186,7 +186,7 @@ void dep_graph_domaint::data_dependencies( } } - dep_graph.reaching_definitions()[to].clear_cache(it->first); + dep_graph.reaching_definitions()[to].clear_cache(read_object_entry.first); } } diff --git a/src/analyses/goto_rw.cpp b/src/analyses/goto_rw.cpp index b584719eba1..4c33d54b78d 100644 --- a/src/analyses/goto_rw.cpp +++ b/src/analyses/goto_rw.cpp @@ -65,20 +65,20 @@ rw_range_sett::~rw_range_sett() void rw_range_sett::output(std::ostream &out) const { out << "READ:\n"; - forall_rw_range_set_r_objects(it, *this) + for(const auto &read_object_entry : get_r_set()) { - out << " " << it->first; - it->second->output(ns, out); + out << " " << read_object_entry.first; + read_object_entry.second->output(ns, out); out << '\n'; } out << '\n'; out << "WRITE:\n"; - forall_rw_range_set_w_objects(it, *this) + for(const auto &written_object_entry : get_w_set()) { - out << " " << it->first; - it->second->output(ns, out); + out << " " << written_object_entry.first; + written_object_entry.second->output(ns, out); out << '\n'; } } diff --git a/src/analyses/goto_rw.h b/src/analyses/goto_rw.h index 67667ea8c34..98a0256bff0 100644 --- a/src/analyses/goto_rw.h +++ b/src/analyses/goto_rw.h @@ -21,14 +21,6 @@ Date: April 2010 #include -#define forall_rw_range_set_r_objects(it, rw_set) \ - for(rw_range_sett::objectst::const_iterator it=(rw_set).get_r_set().begin(); \ - it!=(rw_set).get_r_set().end(); ++it) - -#define forall_rw_range_set_w_objects(it, rw_set) \ - for(rw_range_sett::objectst::const_iterator it=(rw_set).get_w_set().begin(); \ - it!=(rw_set).get_w_set().end(); ++it) - class rw_range_sett; class goto_modelt; @@ -136,10 +128,11 @@ class rw_range_sett return w_range_set; } - const range_domaint &get_ranges(objectst::const_iterator it) const + const range_domaint & + get_ranges(const std::unique_ptr &ranges) const { - PRECONDITION(dynamic_cast(it->second.get())!=nullptr); - return static_cast(*it->second); + PRECONDITION(dynamic_cast(ranges.get()) != nullptr); + return static_cast(*ranges); } enum class get_modet { LHS_W, READ }; @@ -360,11 +353,12 @@ class rw_guarded_range_set_value_sett:public rw_range_set_value_sett { } - const guarded_range_domaint &get_ranges(objectst::const_iterator it) const + const guarded_range_domaint & + get_ranges(const std::unique_ptr &ranges) const { PRECONDITION( - dynamic_cast(it->second.get())!=nullptr); - return static_cast(*it->second); + dynamic_cast(ranges.get()) != nullptr); + return static_cast(*ranges); } void get_objects_rec( diff --git a/src/analyses/reaching_definitions.cpp b/src/analyses/reaching_definitions.cpp index bdcdc609f28..e370467220a 100644 --- a/src/analyses/reaching_definitions.cpp +++ b/src/analyses/reaching_definitions.cpp @@ -139,16 +139,17 @@ void rd_range_domaint::transform( goto_rw(to, rw_set); const bool is_must_alias=rw_set.get_w_set().size()==1; - forall_rw_range_set_w_objects(it, rw_set) + for(const auto &written_object_entry : rw_set.get_w_set()) { - const irep_idt &identifier=it->first; + const irep_idt &identifier = written_object_entry.first; // ignore symex::invalid_object const symbolt *symbol_ptr; if(ns.lookup(identifier, symbol_ptr)) continue; assert(symbol_ptr!=0); - const range_domaint &ranges=rw_set.get_ranges(it); + const range_domaint &ranges = + rw_set.get_ranges(written_object_entry.second); if(is_must_alias && (!rd->get_is_threaded()(from) || @@ -345,9 +346,9 @@ void rd_range_domaint::transform_assign( goto_rw(function_to, to, rw_set); const bool is_must_alias=rw_set.get_w_set().size()==1; - forall_rw_range_set_w_objects(it, rw_set) + for(const auto &written_object_entry : rw_set.get_w_set()) { - const irep_idt &identifier=it->first; + const irep_idt &identifier = written_object_entry.first; // ignore symex::invalid_object const symbolt *symbol_ptr; if(ns.lookup(identifier, symbol_ptr)) @@ -357,7 +358,8 @@ void rd_range_domaint::transform_assign( nullptr_exceptiont, "Symbol is in symbol table"); - const range_domaint &ranges=rw_set.get_ranges(it); + const range_domaint &ranges = + rw_set.get_ranges(written_object_entry.second); if(is_must_alias && (!rd.get_is_threaded()(from) ||