Re: [PATCH] Make dwarf_expr_piece::pieces an std::vector

Pedro Alves
2017-09-14T14:14:09Z

On 09/14/2017 02:57 PM, Simon Marchi wrote:
> I initially left it as a pointer out of laziness, but I've changed it to
> a reference now. I am pushing the patch with this and the const rvalue
> reference fixed.
>
> I tried to add some constructors, but I didn't know how to design it
> nicely to support different types of value locations.

Ah, yes, now that I look better, I see how the function is calling
private context functions.

> Maybe the best
> would be to add some factory functions that build various kinds of
> pieces, and make the constructor private. Something like:
>
> struct dwarf_expr_piece
> {
> static dwarf_expr_piece make_memory_piece (CORE_ADDR addr, bool
> in_stack_memory)
> static dwarf_expr_piece make_register_piece (int regno);
>
> private:
> dwarf_expr_piece ();
> };
>
> I'll try that for a follow-up patch.

That might work. I'm fine with the status quo too, btw.

Thanks,
Pedro Alves