template<typename flavor, typename input, typename arg_type>
static inline value_dispatch *
- make (flavor *&result, const input &x, arg_type &arg)
+ make (flavor *&result, int /*whatattr*/, const input &x, arg_type &arg)
{
assert (alloc_values);
return result = new flavor (x, arg);
template<typename value, typename arg_type = const subr::nothing>
struct init
{
- inline init (attr_value *av,
+ inline init (attr_value *av, int whatattr,
const value &other, arg_type &arg = arg_type ())
{
switch (other.what_space ())
{
-#define _DWARF_DATA_AV_MAKE(flavor, fetch) \
- case dwarf::VS_##flavor: \
- { \
- typename vw::value_##flavor *p; \
- av->_m_value = vw::make (p, other.fetch (), arg); \
- } \
+#define _DWARF_DATA_AV_MAKE(flavor, fetch) \
+ case dwarf::VS_##flavor: \
+ { \
+ typename vw::value_##flavor *p; \
+ av->_m_value = vw::make (p, whatattr, other.fetch (), arg); \
+ } \
break
_DWARF_DATA_AV_MAKE (identifier, identifier);
if (other.constant_is_integer ())
{
typename vw::value_constant *p;
- av->_m_value = vw::make (p, other.constant (), arg);
+ av->_m_value = vw::make (p, whatattr, other.constant (), arg);
}
else
{
typename vw::value_constant_block *p;
- av->_m_value = vw::make (p, other.constant_block (), arg);
+ av->_m_value = vw::make (p, whatattr,
+ other.constant_block (), arg);
}
break;
}
};
- // This kosher only when freshly default-constructed.
+ // This is kosher only when freshly default-constructed.
template<typename value, typename arg_type>
- inline void set (const value &other, arg_type &arg)
+ inline void set (int whatattr, const value &other, arg_type &arg)
{
assert (_m_value == NULL);
- init<value, arg_type> me (this, other, arg);
+ init<value, arg_type> me (this, whatattr, other, arg);
}
template<typename flavor>
: _m_value (NULL)
{
if (other._m_value != NULL)
- init<attr_value> me (this, other);
- }
-
- template<typename value, typename arg_type>
- attr_value (const value &other, arg_type &arg)
- : _m_value (NULL)
- {
- set (this, other, arg);
+ init<attr_value> me (this, 0, other);
}
inline attr_value ()
delete _m_value;
_m_value = NULL;
}
- init<attr_value> me (this, other);
+ init<attr_value> me (this, 0, other);
return *this;
}
template<typename value>
delete _m_value;
_m_value = NULL;
}
- init<value> me (this, other);
+ init<value> me (this, 0, other);
return *this;
}
for (typename input::const_iterator attr = other.begin ();
attr != other.end ();
++attr)
- (*this)[(*attr).first].set ((*attr).second, c);
+ (*this)[(*attr).first].set ((*attr).first, (*attr).second, c);
}
#if 0
return subr::argifier<input, output, dwarf_output_collector &> (c) (in);
}
+ /* Every kind of value is made by calling into the copier, which
+ returns a const pointer into a value_set living in the collector. */
struct value
: public dwarf_data::value<dwarf_output, false>
{
template<typename flavor, typename input>
static inline value_dispatch *
- make (flavor *&, const input &, const subr::nothing &)
+ make (flavor *&, int, const input &, const subr::nothing &)
{
throw std::logic_error ("dwarf_output cannot be default-constructed");
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_string *&, const input &x, copier<input_dw> &c)
+ make (value_string *&, int, const input &x, copier<input_dw> &c)
{
return c.add_string (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_identifier *&, const input &x, copier<input_dw> &c)
+ make (value_identifier *&, int, const input &x, copier<input_dw> &c)
{
return c.add_identifier (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_reference *&, const input &x, copier<input_dw> &c)
+ make (value_reference *&, int, const input &x, copier<input_dw> &c)
{
return c.add_reference (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_flag *&, const input &x, copier<input_dw> &c)
+ make (value_flag *&, int, const input &x, copier<input_dw> &c)
{
return c.add_flag (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_address *&, const input &x, copier<input_dw> &c)
+ make (value_address *&, int, const input &x, copier<input_dw> &c)
{
return c.add_address (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_rangelistptr *&, const input &x, copier<input_dw> &c)
+ make (value_rangelistptr *&, int, const input &x, copier<input_dw> &c)
{
return c.add_ranges (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_lineptr *&, const input &x, copier<input_dw> &c)
+ make (value_lineptr *&, int, const input &x, copier<input_dw> &c)
{
return c.add_line_info (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_constant *&, const input &x, copier<input_dw> &c)
+ make (value_constant *&, int, const input &x, copier<input_dw> &c)
{
return c.add_constant (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_constant_block *&, const input &x, copier<input_dw> &c)
+ make (value_constant_block *&, int, const input &x, copier<input_dw> &c)
{
return c.add_constant_block (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_dwarf_constant *&, const input &x, copier<input_dw> &c)
+ make (value_dwarf_constant *&, int, const input &x, copier<input_dw> &c)
{
return c.add_dwarf_constant (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_source_file *&, const input &x, copier<input_dw> &c)
+ make (value_source_file *&, int attr, const input &x, copier<input_dw> &c)
{
- return c.add_source_file (x);
+ return c.add_source_file (attr, x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_source_line *&, const input &x, copier<input_dw> &c)
+ make (value_source_line *&, int, const input &x, copier<input_dw> &c)
{
return c.add_source_line (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_source_column *&, const input &x, copier<input_dw> &c)
+ make (value_source_column *&, int, const input &x, copier<input_dw> &c)
{
return c.add_source_column (x);
}
template<typename input, typename input_dw>
static inline const value_dispatch *
- make (value_location *&, const input &x, copier<input_dw> &c)
+ make (value_location *&, int, const input &x, copier<input_dw> &c)
{
return c.add_location (x);
}
-
};
public:
public:
typedef debug_info_entry value_type;
-
- inline iterator add_entry (int tag, const iterator &pos)
- {
- return insert (pos, debug_info_entry (tag));
- }
-
- inline iterator add_entry (int tag)
- {
- return add_entry (tag, end ());
- }
};
typedef children_type::iterator pointer;
template<typename input>
inline const value::value_reference *add_reference (const input &x)
{
- // XXX temporary kludge
+ // XXX temporary kludge (leak!)
return new value::value_reference (x, *this);
}
}
template<typename input>
- inline const value::value_source_file *add_source_file (const input &x)
+ inline const value::value_source_file *add_source_file (int /*whatattr*/,
+ const input &x)
{
return _m_collector->_m_source_file.add (x);
}