]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Rewrite check_duplicate_DW_tag_variable as a per-DIE check
authorPetr Machata <pmachata@redhat.com>
Mon, 28 Mar 2011 13:43:44 +0000 (15:43 +0200)
committerPetr Machata <pmachata@redhat.com>
Mon, 28 Mar 2011 14:03:08 +0000 (16:03 +0200)
dwarflint/check_duplicate_DW_tag_variable.cc

index 80f966326a2598aa8d76584f46703ab8009841c1..cd6f4abfafe0fcf73b60b9f81cf0b1c1065763a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2010 Red Hat, Inc.
+   Copyright (C) 2010, 2011 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -23,8 +23,7 @@
    Network licensing program, please visit www.openinventionnetwork.com
    <http://www.openinventionnetwork.com>.  */
 
-#include "highlevel_check.hh"
-#include "all-dies-it.hh"
+#include "check_die_tree.hh"
 #include "pri.hh"
 #include "messages.hh"
 #include <map>
@@ -34,7 +33,7 @@ using elfutils::dwarf;
 namespace
 {
   class check_duplicate_DW_tag_variable
-    : public highlevel_check<check_duplicate_DW_tag_variable>
+    : public die_check
   {
     struct varinfo
     {
@@ -65,18 +64,10 @@ namespace
       return &cd;
     }
 
-    check_duplicate_DW_tag_variable (checkstack &stack, dwarflint &lint);
-  };
-
-  reg<check_duplicate_DW_tag_variable> reg_duplicate_DW_tag_variable;
-}
+    check_duplicate_DW_tag_variable (checkstack &, dwarflint &) {}
 
-check_duplicate_DW_tag_variable
-::check_duplicate_DW_tag_variable (checkstack &stack, dwarflint &lint)
-  : highlevel_check<check_duplicate_DW_tag_variable> (stack, lint)
-{
-  for (all_dies_iterator<dwarf> it = all_dies_iterator<dwarf> (dw);
-       it != all_dies_iterator<dwarf> (); ++it)
+    virtual void
+    die (all_dies_iterator<dwarf> const &it)
     {
       dwarf::debug_info_entry::children_type const &children
        = it->children ();
@@ -91,7 +82,7 @@ check_duplicate_DW_tag_variable
            {
              dwarf::debug_info_entry::attributes_type const &
                attrs = jt->attributes ();
-             dwarf::debug_info_entry::attributes_type::const_iterator
+             dwarf::debug_info_entry::attributes_type::const_iterator
                at, et = attrs.end ();
              if ((at = attrs.find (DW_AT_name)) == et)
                continue;
@@ -136,4 +127,6 @@ check_duplicate_DW_tag_variable
            }
        }
     }
+  };
+  reg_die_check<check_duplicate_DW_tag_variable> reg;
 }