{
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 ();
}
{
public:
+ template<class impl>
+ 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<typename die_type>
+ 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<typename die_type, typename tracker>
+ 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:
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<typename die_type, typename tracker>
- 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<dwarf_edit> compile_unit;
// Main container anchoring all the output.
class compile_units : public std::list<compile_unit>