From: Petr Machata Date: Thu, 17 Mar 2011 16:19:52 +0000 (+0100) Subject: dwarflint: Extract "local function" out of the method X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1922758be240bdedec894e99c421e09e83301784;p=thirdparty%2Felfutils.git dwarflint: Extract "local function" out of the method --- diff --git a/dwarflint/check_dups_abstract_origin.cc b/dwarflint/check_dups_abstract_origin.cc index 58db89f1b..9bcef17b9 100644 --- a/dwarflint/check_dups_abstract_origin.cc +++ b/dwarflint/check_dups_abstract_origin.cc @@ -28,7 +28,6 @@ #endif #include "highlevel_check.hh" -#include "../src/dwarfstrings.h" #include "all-dies-it.hh" #include "pri.hh" #include "messages.hh" @@ -55,39 +54,38 @@ namespace return &cd; } - explicit check_dups_abstract_origin (checkstack &stack, dwarflint &lint) - : highlevel_check (stack, lint) + void + check_die_attr (dwarf::debug_info_entry const &die, + dwarf::attribute const &attr) { - struct { - void operator () (dwarf::debug_info_entry const &die, - dwarf::attribute const &attr) - { - std::map m; - for (dwarf::debug_info_entry::attributes_type::const_iterator - at = die.attributes ().begin (); - at != die.attributes ().end (); ++at) - m.insert (std::make_pair ((*at).first, (*at).second)); + std::map m; + for (dwarf::debug_info_entry::attributes_type::const_iterator + at = die.attributes ().begin (); + at != die.attributes ().end (); ++at) + m.insert (std::make_pair ((*at).first, (*at).second)); - dwarf::attr_value const &val = attr.second; - // xxx Referree can't be const&, gives memory errors. - dwarf::debug_info_entry referree = *val.reference (); + dwarf::attr_value const &val = attr.second; + // xxx Referree can't be const&, gives memory errors. + dwarf::debug_info_entry referree = *val.reference (); - std::map::const_iterator at2; - for (dwarf::debug_info_entry::attributes_type::const_iterator - at = referree.attributes ().begin (); - at != referree.attributes ().end (); ++at) - if ((at2 = m.find ((*at).first)) != m.end ()) - wr_message (to_where (die), - cat (mc_impact_3, mc_acc_bloat, mc_die_rel)) - << "Attribute " << dwarf::attributes::name (at2->first) - << " is duplicated at " << dwarf::attributes::name (attr.first) - << " (" << pri::ref (referree) << ")" - << (at2->second == (*at).second - ? "." : " with different value.") - << std::endl; - } - } check_die_attr; + std::map::const_iterator at2; + for (dwarf::debug_info_entry::attributes_type::const_iterator + at = referree.attributes ().begin (); + at != referree.attributes ().end (); ++at) + if ((at2 = m.find ((*at).first)) != m.end ()) + wr_message (to_where (die), + cat (mc_impact_3, mc_acc_bloat, mc_die_rel)) + << "Attribute " << dwarf::attributes::name (at2->first) + << " is duplicated at " << dwarf::attributes::name (attr.first) + << " (" << pri::ref (referree) << ")" + << (at2->second == (*at).second + ? "." : " with different value.") + << std::endl; + } + explicit check_dups_abstract_origin (checkstack &stack, dwarflint &lint) + : highlevel_check (stack, lint) + { for (all_dies_iterator it = all_dies_iterator (dw); it != all_dies_iterator (); ++it) {