From: Roland McGrath Date: Sat, 4 Jul 2009 09:25:23 +0000 (-0700) Subject: Move dwarf_edit::compile_unit into dwarf_data. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f830e4762646190642a2155b8f9f40360832b86;p=thirdparty%2Felfutils.git Move dwarf_edit::compile_unit into dwarf_data. --- diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf index d31d0107f..103dc08df 100644 --- a/libdw/c++/dwarf +++ b/libdw/c++/dwarf @@ -1007,11 +1007,11 @@ namespace elfutils { return line_info ().include_directories (); } - const file_table files () const + inline const file_table files () const { return line_info ().files (); } - const line_table lines () const + inline const line_table lines () const { return line_info ().lines (); } diff --git a/libdw/c++/dwarf_data b/libdw/c++/dwarf_data index 76a44e014..5b2945e95 100644 --- a/libdw/c++/dwarf_data +++ b/libdw/c++/dwarf_data @@ -68,6 +68,64 @@ namespace elfutils { public: + template + class compile_unit : public impl::debug_info_entry + { + friend class subr::create_container; + friend class impl::compile_units; + private: + inline compile_unit () : + impl::debug_info_entry (::DW_TAG_compile_unit) + {} + + template + static inline const die_type &require_cu (const die_type &die) + { + if (die.tag () != ::DW_TAG_compile_unit) + throw std::invalid_argument ("not a compile_unit entry"); + return die; + } + + template + inline compile_unit (const die_type &die, tracker &t) + : impl::debug_info_entry (require_cu (die), t) + {} + + public: + + // Fetch the CU's DW_AT_stmt_list. + inline const typename impl::line_info_table &line_info () const + { + return this->attributes ()[::DW_AT_stmt_list].line_info (); + } + + inline typename impl::line_info_table &line_info () + { + return this->attributes ()[::DW_AT_stmt_list].line_info (); + } + + // Convenience methods for line_info_table sub-containers. + inline const typename impl::directory_table &include_directories () const + { + return line_info ().include_directories (); + } + + inline typename impl::directory_table &include_directories () + { + return line_info ().include_directories (); + } + + inline const typename impl::line_table &lines () const + { + return line_info ().lines (); + } + + inline typename impl::line_table &lines () + { + return line_info ().lines (); + } + }; + class source_file { private: diff --git a/libdw/c++/dwarf_edit b/libdw/c++/dwarf_edit index 40873e4b2..ef4ebec7c 100644 --- a/libdw/c++/dwarf_edit +++ b/libdw/c++/dwarf_edit @@ -268,28 +268,7 @@ namespace elfutils typedef debug_info_entry::attributes_type::value_type attribute; - class compile_unit : public debug_info_entry - { - friend class subr::create_container; - friend class compile_units; - private: - inline compile_unit () : debug_info_entry (::DW_TAG_compile_unit) {} - - // XXX should be private - public: - template - inline compile_unit (const die_type &die, tracker &t) - : debug_info_entry (die, t) - { - if (die.tag () != ::DW_TAG_compile_unit) - throw std::invalid_argument ("not a compile_unit entry"); - } - - /* XXX doesn't help - public: - compile_unit (const compile_unit &u) : debug_info_entry (u) {} - */ - }; + typedef dwarf_data::compile_unit compile_unit; // Main container anchoring all the output. class compile_units : public std::list