]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Merge branch 'dwarf' of ssh://git.fedorahosted.org/git/elfutils into dwarf
authorPetr Machata <pmachata@redhat.com>
Wed, 6 Apr 2011 10:08:41 +0000 (12:08 +0200)
committerPetr Machata <pmachata@redhat.com>
Wed, 6 Apr 2011 10:08:41 +0000 (12:08 +0200)
1  2 
dwarflint/check_linkage_external_die.cc
dwarflint/check_self_referential_die.cc

index e18d0e9734f5c3d05e43e81230a947a41815a089,7cebc46bae7f8910e463f35a4ebae986893f8e95..485ac8457f4f38f89bdc9063a456d5ffdff691ef
@@@ -53,24 -46,25 +46,25 @@@ namespac
        return &cd;
      }
  
-     explicit check_linkage_external_die (checkstack &stack, dwarflint &lint)
-       : highlevel_check<check_linkage_external_die> (stack, lint)
 -    check_linkage_external_die (checkstack &, dwarflint &)
++    check_linkage_external_die (highlevel_check_i *, checkstack &, dwarflint &)
+     {
+       // We don't keep any state for this die check.
+     }
+     virtual void
+     die (all_dies_iterator<dwarf> const &it)
      {
-       for (all_dies_iterator<dwarf> it = all_dies_iterator<dwarf> (dw);
-          it != all_dies_iterator<dwarf> (); ++it)
+       dwarf::debug_info_entry const &entry = *it;
+       dwarf::debug_info_entry::attributes_type attrs = entry.attributes ();
+       if ((attrs.find (DW_AT_linkage_name) != attrs.end ()
+          || attrs.find (DW_AT_MIPS_linkage_name) != attrs.end ())
+         && attrs.find (DW_AT_external) == attrs.end ())
        {
-         dwarf::debug_info_entry const &die = *it;
-         dwarf::debug_info_entry::attributes_type attrs = die.attributes ();
-         if ((attrs.find (DW_AT_linkage_name) != attrs.end ()
-              || attrs.find (DW_AT_MIPS_linkage_name) != attrs.end ())
-             && attrs.find (DW_AT_external) == attrs.end ())
-           {
-             wr_message (to_where (die),
-                         mc_impact_3 | mc_acc_suboptimal | mc_die_other)
-               << elfutils::dwarf::tags::name (die.tag ())
-               << " has linkage_name attribute, but no external attribute."
-               << std::endl;
-           }
+         wr_message (to_where (entry),
+                     mc_impact_3 | mc_acc_suboptimal | mc_die_other)
+           << elfutils::dwarf::tags::name (entry.tag ())
+           << " has linkage_name attribute, but no external attribute."
+           << std::endl;
        }
      }
    };
index 196193b65546ddc320a5704a8ebcff0e6816059e,47fde991623c83c63ef4b4ac15931eb680ebff34..bf62bf4a34ae5671a051fef169af97389ef680b2
@@@ -55,27 -48,29 +48,29 @@@ namespac
        return &cd;
      }
  
-     explicit check_self_referential_die (checkstack &stack, dwarflint &lint)
-       : highlevel_check<check_self_referential_die> (stack, lint)
 -    check_self_referential_die (checkstack &, dwarflint &)
++    check_self_referential_die (highlevel_check_i *, checkstack &, dwarflint &)
+     {
+       // We don't keep any state for this die check.
+     }
+     virtual void
+     die (all_dies_iterator<dwarf> const &it)
      {
-       for (all_dies_iterator<dwarf> it = all_dies_iterator<dwarf> (dw);
-          it != all_dies_iterator<dwarf> (); ++it)
+       dwarf::debug_info_entry const &entry = *it;
+       for (dwarf::debug_info_entry::attributes_type::const_iterator
+            at = entry.attributes ().begin ();
+          at != entry.attributes ().end (); ++at)
        {
-         dwarf::debug_info_entry const &die = *it;
-         for (dwarf::debug_info_entry::attributes_type::const_iterator
-                at = die.attributes ().begin ();
-              at != die.attributes ().end (); ++at)
+         dwarf::attr_value const &val = (*at).second;
+         if (val.what_space () == dwarf::VS_reference)
            {
-             dwarf::attr_value const &val = (*at).second;
-             if (val.what_space () == dwarf::VS_reference)
-               {
-                 dwarf::debug_info_entry ref = *val.reference ();
-                 if (ref.identity () == die.identity ())
-                   wr_message (to_where (die),
-                               mc_impact_3 | mc_acc_suboptimal | mc_die_rel)
-                     << "attribute " << dwarf::attributes::name ((*at).first)
-                     << " references DIE itself." << std::endl;
-               }
+             dwarf::debug_info_entry ref = *val.reference ();
+             if (ref.identity () == entry.identity ())
+               wr_message (to_where (entry),
+                           mc_impact_3 | mc_acc_suboptimal | mc_die_rel)
+                 << dwarf::tags::name (entry.tag ())
+                 << " attribute " << dwarf::attributes::name ((*at).first)
+                 << " references DIE itself." << std::endl;
            }
        }
      }