]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Remove directory_table/include_directories as distinct item from line_info_table.
authorRoland McGrath <roland@redhat.com>
Wed, 1 Dec 2010 01:16:09 +0000 (17:16 -0800)
committerRoland McGrath <roland@redhat.com>
Wed, 1 Dec 2010 01:16:09 +0000 (17:16 -0800)
libdw/ChangeLog
libdw/c++/dwarf
libdw/c++/dwarf_data
libdw/c++/dwarf_edit
libdw/c++/dwarf_output
libdw/c++/edit-values.cc
libdw/c++/line_info.cc
libdw/c++/values.cc

index e0d844343a2ae345e9a6749af1e52337cb9d0fb4..e1b440f3739075c6ad56dc9ee9cf8f34d0649e9b 100644 (file)
@@ -1,3 +1,20 @@
+2010-11-30  Roland McGrath  <roland@redhat.com>
+
+       * c++/dwarf (dwarf::directory_table): Remove class.
+       (dwarf::compile_unit::include_directories): Remove method.
+       (dwarf::line_info_table::include_directories): Remove method.
+       (dwarf::line_info_table::operator==): Don't use it.
+       * c++/dwarf_data (dwarf_data::directory_table): Remove class.
+       (dwarf_data::compile_unit::include_directories): Remove method.
+       (dwarf_data::line_info_table::include_directories): Remove method.
+       (dwarf_data::line_info_table::hasher): Replace.
+       (dwarf_data::line_info_table::operator==): Don't use it.
+       * c++/dwarf_output (dwarf_output::directory_table): Remove class.
+       * c++/values.cc (line_info_string): Ignore include_directories.
+       (dwarf::directory_table): Remove methods.
+       * c++/line_info.cc (dwarf::directory_table): Remove methods.
+       * c++/edit-values.cc (dwarf_data::line_table): Update instantiation.
+
 2010-10-13  Roland McGrath  <roland@redhat.com>
 
        * dwarf.h: Add DW_LANG_Go.
index 4ab57ce8fad7adab2830e0adc3f99ec91a5bd8d0..0c24bb3d24a1411781135b386406f38ac095d922 100644 (file)
@@ -408,7 +408,6 @@ namespace elfutils
     class range_list;
     class ranges;
     class line_info_table;
-    class directory_table;
     class file_table;
     class line_table;
     class line_entry;
@@ -1034,10 +1033,6 @@ namespace elfutils
       const line_info_table line_info () const;
 
       // Convenience methods for line_info_table sub-containers.
-      inline const directory_table include_directories () const
-      {
-       return line_info ().include_directories ();
-      }
       inline const file_table files () const
       {
        return line_info ().files ();
@@ -1601,67 +1596,6 @@ namespace elfutils
        */
     };
 
-    // This describes a CU's directory table, a simple array of strings.
-    class directory_table
-    {
-    private:
-      ::Dwarf_Files *_m_files;
-
-      template<typename table>
-      inline bool table_equal (const table &other) const
-      {
-       /* We ignore the first element, the compilation directory.
-          This is not encoded in the .debug_line table, but in
-          the DW_AT_comp_dir attribute of the referring CU.
-          The directory table itself matches regardless.  */
-       const_iterator i = begin ();
-       typename table::const_iterator j = other.begin ();
-       return subr::container_equal
-         (++i, end (), ++j, other.end (),
-          subr::deref<directory_table, table,
-                      subr::name_equal<typename table::value_type> > ());
-      }
-
-    public:
-      typedef size_t size_type;
-      typedef ptrdiff_t difference_type;
-      typedef const char *value_type;
-
-      inline directory_table (::Dwarf_Files *const files)
-       : _m_files (files) {}
-      inline directory_table (const directory_table &t)
-       : _m_files (t._m_files) {}
-
-      std::string to_string () const;
-
-      typedef const char *const *const_iterator;
-
-      inline bool empty () const
-      {
-       return size () == 0;
-      }
-
-      size_t size () const;
-      const_iterator begin () const;
-      const_iterator end () const;
-
-      template<typename table>
-      inline bool operator== (const table &other) const
-      {
-       return table_equal (other);
-      }
-      template<typename table>
-      inline bool operator!= (const table &other) const
-      {
-       return !(*this == other);
-      }
-      // Short-circuit for comparing to self.
-      inline bool operator== (const directory_table &other) const
-      {
-       return _m_files == other._m_files || table_equal (other);
-      }
-    };
-
     /* This describes a CU's file table.  It works like a read-only
        std::vector<source_file>, and also supports lookup by name.  */
     class file_table
@@ -1887,10 +1821,6 @@ namespace elfutils
 
       std::string to_string () const;
 
-      inline const directory_table include_directories () const
-      {
-       return directory_table (_m_files);
-      }
       inline const file_table files () const
       {
        return file_table (_m_files);
@@ -1900,8 +1830,7 @@ namespace elfutils
       template<typename table>
       inline bool operator== (const table &other) const
       {
-       return (include_directories () == other.include_directories ()
-               && lines () == other.lines ());
+       return lines () == other.lines ();
       }
       template<typename table>
       inline bool operator!= (const table &other) const
index ebf5b0e4d9f4c2414c9bb4f4ace1687d8ea6c55e..2e8f0613115c97f5ba004dac666241dcd2ad2856 100644 (file)
@@ -157,11 +157,6 @@ namespace elfutils
       }
 
       // Convenience methods for line_info_table sub-containers.
-      inline const typename impl::directory_table &include_directories () const
-      {
-       return line_info ().include_directories ();
-      }
-
       inline const typename impl::line_table &lines () const
       {
        return line_info ().lines ();
@@ -173,11 +168,6 @@ namespace elfutils
        return this->attributes ()[::DW_AT_stmt_list].line_info ();
       }
 
-      inline typename impl::directory_table &include_directories ()
-      {
-       return line_info ().include_directories ();
-      }
-
       inline typename impl::line_table &lines ()
       {
        return line_info ().lines ();
@@ -298,46 +288,6 @@ namespace elfutils
       }
     };
 
-    // This describes a CU's directory table, a simple array of strings.
-    class directory_table : public std::vector<std::string>
-    {
-    private:
-      typedef std::vector<std::string> _base;
-
-    public:
-      struct hasher : public subr::container_hasher<directory_table> {};
-
-      directory_table () {}
-
-      template<typename table>
-      directory_table (const table &other)
-      {
-       /* The first entry is "special". It can be NULL/empty.
-          This is not encoded in the .debug_line table, but in
-          the DW_AT_comp_dir attribute of the referring CU.  */
-       typename table::const_iterator first = other.begin ();
-       _base::push_back (*first ?: "");
-       _base::insert (_base::end (), ++first, other.end ());
-      }
-
-      std::string to_string () const;
-
-      template<typename table>
-      inline bool operator== (const table &other) const
-      {
-       /* We ignore the first element, the compilation directory.
-          This is actually part of the CU, not part of the line info.
-          The directory table itself matches regardless.  */
-       return (size () == other.size ()
-               && subr::container_tail_equal (*this, other, 1));
-      }
-      template<typename table>
-      inline bool operator!= (const table &other) const
-      {
-       return !(*this == other);
-      }
-    };
-
   private:
 
     /* This is the common base class for all line_entry<T> instantiations.
@@ -550,58 +500,52 @@ namespace elfutils
       const_iterator find (::Dwarf_Addr) const;
     };
 
-    /* This holds the entirety of line information.  It's parameterized
-       by the directory_table and line_table representations.  */
-    template<typename directory_table, typename line_table>
+    /* This holds the entirety of line information.
+       The line_table is all there actually is.  */
+    template<typename line_table>
     class line_info_table
-      : private std::pair<directory_table, line_table>
     {
     private:
-      typedef std::pair<directory_table, line_table> _base;
+      line_table _m_lines;
 
     public:
-      friend class subr::base_hasher<line_info_table, _base>;
-      typedef subr::base_hasher<line_info_table, _base> hasher;
+      struct hasher : public std::unary_function<line_info_table, size_t>
+      {
+       inline size_t operator () (const line_info_table &info) const
+       {
+         return subr::hash_this (info._m_lines);
+       }
+      };
 
-      inline line_info_table () : _base () {}
+      inline line_info_table () {}
 
       template<typename table>
       inline line_info_table (const table &other)
-       : _base (other.include_directories (), other.lines ())
+       : _m_lines (other.lines ())
       {}
 
       template<typename table>
       inline line_info_table &operator= (const table &other)
       {
-       this->first = directory_table (other.include_directories ());
-       this->second = line_table (other.lines ());
+       _m_lines = line_table (other.lines ());
        return *this;
       }
 
       std::string to_string () const;
 
-      inline directory_table &include_directories ()
-      {
-       return this->first;
-      }
-      inline const directory_table &include_directories () const
-      {
-       return this->first;
-      }
       inline line_table &lines ()
       {
-       return this->second;
+       return _m_lines;
       }
       inline const line_table &lines () const
       {
-       return this->second;
+       return _m_lines;
       }
 
       template<typename table>
       inline bool operator== (const table &other) const
       {
-       return (include_directories () == other.include_directories ()
-               && lines () == other.lines ());
+       return lines () == other.lines ();
       }
       template<typename table>
       inline bool operator!= (const table &other) const
index 19e5493f12a82ffe71fc157014f3869788170ce9..fd41100c9d4f6c2aa039409ae9fa8d78eb749b81 100644 (file)
@@ -95,11 +95,9 @@ namespace elfutils
 
   public:
     typedef dwarf_data::source_file source_file;
-    typedef dwarf_data::directory_table directory_table;
     typedef dwarf_data::line_entry<source_file> line_entry;
     typedef dwarf_data::line_table<line_entry> line_table;
-    typedef dwarf_data::line_info_table<directory_table,
-                                       line_table> line_info_table;
+    typedef dwarf_data::line_info_table<line_table> line_info_table;
     typedef dwarf_data::dwarf_enum dwarf_enum;
     typedef dwarf_data::range_list range_list;
     typedef dwarf_data::location_attr location_attr;
@@ -390,8 +388,7 @@ namespace elfutils
   // Explicit instantiations.
   extern template class dwarf_data::line_entry<dwarf_edit::source_file>;
   extern template class dwarf_data::line_table<dwarf_edit::line_entry>;
-  extern template class dwarf_data::line_info_table<dwarf_edit::directory_table,
-                                                   dwarf_edit::line_table>;
+  extern template class dwarf_data::line_info_table<dwarf_edit::line_table>;
   extern template class dwarf_data::attr_value<dwarf_edit>;
   extern template class dwarf_data::value<dwarf_edit>;
 
index 86e59a2ed9b17a92eb4feb5e56f8f470b864db95..b7bbaadc99faeb13ba8a6b63ec9af09a2ec9c868 100644 (file)
@@ -87,11 +87,9 @@ namespace elfutils
 
   public:
     typedef dwarf_data::source_file source_file;
-    typedef dwarf_data::directory_table directory_table;
     typedef dwarf_data::line_entry<source_file> line_entry;
     typedef dwarf_data::line_table<line_entry> line_table;
-    typedef dwarf_data::line_info_table<directory_table,
-                                       line_table> line_info_table;
+    typedef dwarf_data::line_info_table<line_table> line_info_table;
     typedef dwarf_data::dwarf_enum dwarf_enum;
     typedef dwarf_data::range_list range_list;
     typedef dwarf_data::location_attr location_attr;
index 976d315e8de757447bbd60aeb8464ea4cf05d06e..7c17b2bf4747dbf16590fb5399a9369ea6cb252a 100644 (file)
@@ -1,5 +1,5 @@
 /* elfutils::dwarf_edit attribute value interfaces.
-   Copyright (C) 2009 Red Hat, Inc.
+   Copyright (C) 2009-2010 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -56,8 +56,7 @@ using namespace elfutils;
 // Explicit instantiations.
 template class dwarf_data::line_entry<dwarf_edit::source_file>;
 template class dwarf_data::line_table<dwarf_edit::line_entry>;
-template class dwarf_data::line_info_table<dwarf_edit::directory_table,
-                                          dwarf_edit::line_table>;
+template class dwarf_data::line_info_table<dwarf_edit::line_table>;
 template class dwarf_data::attr_value<dwarf_edit>;
 template class dwarf_data::value<dwarf_edit>;
 
index 83e625109fa8f631444570df5a502742b34f5496..e613c16bfdbcb15d34ba3dea41f8c5b9b7d3aac6 100644 (file)
@@ -171,33 +171,6 @@ dwarf::source_file::to_string () const
   return os.str ();
 }
 \f
-// dwarf::directory_table
-
-size_t
-dwarf::directory_table::size () const
-{
-  return _m_files->ndirs;
-}
-
-static inline dwarf::directory_table::const_iterator
-directory_table_array (Dwarf_Files *files)
-{
-  // See dwarf_getsrcdirs.
-  return reinterpret_cast<const char *const *> (&files->info[files->nfiles]);
-}
-
-dwarf::directory_table::const_iterator
-dwarf::directory_table::begin () const
-{
-  return directory_table_array (_m_files);
-}
-
-dwarf::directory_table::const_iterator
-dwarf::directory_table::end () const
-{
-  return directory_table_array (_m_files) + _m_files->ndirs;
-}
-\f
 // dwarf::file_table
 
 size_t
index 851abf6890b8ba44699e442192c7fe771f25ee65..f255d7943fc8b89365124a8055398adc6566b5ef 100644 (file)
@@ -663,8 +663,7 @@ template<typename line_info_table>
 static inline std::string
 line_info_string (const line_info_table *table)
 {
-  return ("[" + table->include_directories ().to_string ()
-         + ", " + table->lines ().to_string () + "]");
+  return ("[" + table->lines ().to_string () + "]");
 }
 
 std::string
@@ -684,26 +683,6 @@ namespace elfutils
 
 };
 \f
-// dwarf::directory_table
-
-static std::string
-dirtable_string (size_t ndirs)
-{
-  return dec_string (ndirs, "{", " dirs}");
-}
-
-std::string
-dwarf::directory_table::to_string () const
-{
-  return dirtable_string (_m_files->ndirs);
-}
-
-std::string
-dwarf_data::directory_table::to_string () const
-{
-  return dirtable_string (size ());
-}
-\f
 // dwarf::line_table
 
 std::string