diff options
| author | Petr Machata <[email protected]> | 2011-03-17 17:19:52 +0100 |
|---|---|---|
| committer | Petr Machata <[email protected]> | 2011-03-17 17:19:52 +0100 |
| commit | 1922758be240bdedec894e99c421e09e83301784 (patch) | |
| tree | 46b2f211cd9b8a6037d3d219c2a595f020c3214a | |
| parent | a1cf43e485048a4f13790188cb72bc2cc4c6f996 (diff) | |
dwarflint: Extract "local function" out of the method
| -rw-r--r-- | dwarflint/check_dups_abstract_origin.cc | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/dwarflint/check_dups_abstract_origin.cc b/dwarflint/check_dups_abstract_origin.cc index 58db89f1..9bcef17b 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<check_dups_abstract_origin> (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<unsigned int, dwarf::attr_value> 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<unsigned int, dwarf::attr_value> 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<unsigned int, dwarf::attr_value>::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<unsigned int, dwarf::attr_value>::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<check_dups_abstract_origin> (stack, lint) + { for (all_dies_iterator<dwarf> it = all_dies_iterator<dwarf> (dw); it != all_dies_iterator<dwarf> (); ++it) { |
