typedef std::pair<directory_table, line_table> _base;
public:
+ friend class subr::base_hasher<line_info_table, _base>;
+ typedef subr::base_hasher<line_info_table, _base> hasher;
+
inline line_info_table () : _base () {}
template<typename table>
{}
public:
- struct hasher
- : public std::unary_function<dwarf_enum, size_t>
- {
- size_t operator () (const dwarf_enum &v) const
- {
- return subr::hash_this<_base> (v);
- }
- };
+ friend class subr::base_hasher<dwarf_enum, _base>;
+ typedef subr::base_hasher<dwarf_enum, _base> hasher;
inline dwarf_enum (unsigned int attr, unsigned int value)
: _base (value, attr)
inline value_location (const loc &other, arg_type &)
: location_attr (other)
{}
+
+ template<typename loc>
+ inline value_location (const loc &other)
+ : location_attr (other)
+ {}
};
};
throw std::logic_error ("dwarf_output cannot be default-constructed");
}
- // XXX temporary
- template<typename flavor, typename input, typename input_dw>
- static inline value_dispatch *
- make (flavor *&result, const input &x, copier<input_dw> &c)
- {
- return result = new flavor (x, c);
- }
-
template<typename input, typename input_dw>
static inline const value_dispatch *
make (value_string *&, const input &x, copier<input_dw> &c)
return c.add_identifier (x);
}
- // XXX reference
+ template<typename input, typename input_dw>
+ static inline const value_dispatch *
+ make (value_reference *&, const input &x, copier<input_dw> &c)
+ {
+ return c.add_reference (x);
+ }
template<typename input, typename input_dw>
static inline const value_dispatch *
return c.add_ranges (x);
}
- /* XXX lineptr
template<typename input, typename input_dw>
static inline const value_dispatch *
make (value_lineptr *&, const input &x, copier<input_dw> &c)
{
return c.add_line_info (x);
}
- */
template<typename input, typename input_dw>
static inline const value_dispatch *
}
// XXX macptr
- // XXX location
+
+ template<typename input, typename input_dw>
+ static inline const value_dispatch *
+ make (value_location *&, const input &x, copier<input_dw> &c)
+ {
+ return c.add_location (x);
+ }
+
};
public:
subr::value_set<dwarf_output::value::value_identifier> _m_identifiers;
subr::value_set<dwarf_output::value::value_address> _m_address;
subr::value_set<dwarf_output::value::value_rangelistptr> _m_ranges;
+ subr::value_set<dwarf_output::value::value_lineptr> _m_line_info;
subr::value_set<dwarf_output::value::value_constant> _m_constants;
subr::value_set<dwarf_output::value::value_constant_block> _m_const_block;
subr::value_set<dwarf_output::value::value_dwarf_constant> _m_dwarf_const;
subr::value_set<dwarf_output::value::value_source_file> _m_source_file;
subr::value_set<dwarf_output::value::value_source_line> _m_source_line;
subr::value_set<dwarf_output::value::value_source_column> _m_source_column;
+ subr::value_set<dwarf_output::value::value_location> _m_locations;
static const dwarf_output::value::value_flag flag_true;
static const dwarf_output::value::value_flag flag_false;
return _m_collector->_m_identifiers.add (x);
}
+ template<typename input>
+ inline const value::value_reference *add_reference (const input &x)
+ {
+ // XXX temporary kludge
+ return new value::value_reference (x, *this);
+ }
+
template<typename input>
inline const value::value_flag *add_flag (const input &x)
{
return _m_collector->_m_ranges.add (x);
}
+ template<typename input>
+ inline const value::value_lineptr *add_line_info (const input &x)
+ {
+ return _m_collector->_m_line_info.add (x, *_m_collector);
+ }
+
template<typename input>
inline const value::value_constant *add_constant (const input &x)
{
{
return _m_collector->_m_source_column.add (x);
}
+
+ template<typename input>
+ inline const value::value_location *add_location (const input &x)
+ {
+ return _m_collector->_m_locations.add (x);
+ }
};
// Copy construction instantiates a copier derived from the collector.
hash_combine (seed, v.second);
}
+ template<typename T, typename B>
+ struct base_hasher : public std::unary_function<T, size_t>
+ {
+ size_t operator () (const T &v) const
+ {
+ return subr::hash_this<B> (v);
+ }
+ };
+
template<typename T>
struct integer_hash : public std::unary_function<T, size_t>
{
{
return add (value_type (v));
}
+
+ template<typename input, typename arg_type>
+ const value_type *add (const input &v, arg_type &arg)
+ {
+ return add (value_type (v, arg));
+ }
};
// A container of hashed_value's that itself acts like a hashed_value.