From: Roland McGrath Date: Sat, 4 Jul 2009 09:58:30 +0000 (-0700) Subject: Move dwarf_edit::compile_units into dwarf_data. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e110acd9812e40562e29cd29d6442a69e1dc29c5;p=thirdparty%2Felfutils.git Move dwarf_edit::compile_units into dwarf_data. --- diff --git a/libdw/c++/dwarf_data b/libdw/c++/dwarf_data index 5b2945e95..12bae8fdd 100644 --- a/libdw/c++/dwarf_data +++ b/libdw/c++/dwarf_data @@ -68,6 +68,38 @@ namespace elfutils { public: + // Main container anchoring all the output. + template + class compile_units : public std::list + { + friend class subr::create_container; + + protected: + typedef std::list _base; + + // Constructor copying CUs from input container. + template + inline compile_units (const input &other, tracker &t) + { + subr::create_container (this, other, t); + } + + public: + // Default constructor: an empty container, no CUs. + inline compile_units () {} + + template + bool operator== (const other_children &other) const + { + return subr::container_equal (*this, other); + } + template + bool operator!= (const other_children &other) const + { + return !(*this == other); + } + }; + template class compile_unit : public impl::debug_info_entry { diff --git a/libdw/c++/dwarf_edit b/libdw/c++/dwarf_edit index ef4ebec7c..73eff2735 100644 --- a/libdw/c++/dwarf_edit +++ b/libdw/c++/dwarf_edit @@ -101,8 +101,6 @@ namespace elfutils typedef dwarf_data::location_attr location_attr; typedef dwarf_data::attr_value attr_value; - class compile_units; - class debug_info_entry { friend class subr::create_container; @@ -271,55 +269,34 @@ namespace elfutils typedef dwarf_data::compile_unit compile_unit; // Main container anchoring all the output. - class compile_units : public std::list + class compile_units + : public dwarf_data::compile_units { friend class dwarf_edit; - friend class subr::create_container; private: - typedef std::list _base; - - // Default constructor: an empty container, no CUs. - inline compile_units () {} - // Constructor copying CUs from input container. template inline compile_units (const input &other, tracker &t) + : dwarf_data::compile_units (other, t) + {} + + inline compile_units (const compile_units &) + : dwarf_data::compile_units () { - subr::create_container (this, other, t); + throw std::logic_error + ("must copy-construct top-level dwarf_edit object instead"); } -#if 0 // dwarf_output might use this (?) - template - inline compile_units (const input &units, tracker &t) - : _base (subr::argify - (units.begin (), t), - subr::argify - (units.end (), t)) - {} -#endif - public: - typedef compile_unit value_type; - typedef _base::iterator iterator; - typedef _base::const_iterator const_iterator; + // Default constructor: an empty container, no CUs. + inline compile_units () {} inline compile_unit &add_unit () { push_back (compile_unit ()); return back (); } - - template - bool operator== (const other_children &other) const - { - return subr::container_equal (*this, other); - } - template - bool operator!= (const other_children &other) const - { - return !(*this == other); - } }; private: @@ -344,9 +321,7 @@ namespace elfutils } // Default constructor: an empty container, no CUs. - inline dwarf_edit () - : _m_units () - {} + inline dwarf_edit () {} // Constructor copying CUs from an input file (dwarf or dwarf_edit). template