From: Simon Marchi <simon.marchi@ericsson.com>
To: Alan Hayward <Alan.Hayward@arm.com>,
Philipp Rudo <prudo@linux.vnet.ibm.com>,
Simon Marchi <simark@simark.ca>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
nd <nd@arm.com>, Yao Qi <qiyaoltc@gmail.com>
Subject: Re: [PATCH] Use visitors for make_gdb_type
Date: Mon, 29 Jan 2018 16:13:00 -0000 [thread overview]
Message-ID: <edb69de1-bbbe-bf9f-78c9-c07237338d3c@ericsson.com> (raw)
In-Reply-To: <707546ED-241F-4641-97A9-551C6FF0E7B4@arm.com>
On 2018-01-29 10:31 AM, Alan Hayward wrote:
>> On Sun, 28 Jan 2018 21:24:19 -0500
>> Simon Marchi <simark@simark.ca> wrote:
>>
>>> On 2018-01-26 10:30 AM, Alan Hayward wrote:
>>>> I appear to still have email issues - previous post had the tabs stripped out.
>>>> Hoping this version is ok. Apologies.
>>>
>>> Hi Alan,
>>>
>>> I was able to apply it correctly.
>>>>
>
> Very strange! Think Iâm ok now.
Well, now I am unable to apply this one :(. The message body is encoded in base64,
I tried to decode it and apply it with git-apply, but it doesn't apply, not sure why.
git-send-email is really the safest way.
>>>> + void visit_pre (const target_desc *e)
>>>> + {}
>>>
>>> I think we should have empty default implementations of these visit functions in the
>>> base class, instead of having to declare them empty when unnecessary. Maybe Yao had
>>> a reason not to do this initially?
>>>
>
> I think Yao didnât add the method because tdesc_element_visitor is meant to be an interface
> and remain abstract.
A type can be abstract but have implementations for some of its methods. To make a type abstract,
it is common to make the destructor pure virtual, if no other method is pure virtual.
> I considered putting the types into a parent class of tdesc_element_visitor, but that breaks
> the accept() functions horribly.
> Instead, Iâve created a new subclass from tdesc_element_visitor called tdesc_element_type_visitor
> which provides null implementations for all the non type visit functions. gdb_type_creator can
> now inherit from tdesc_element_type_visitor and only has to provide the three visitors.
>
> Are you happy with that?
That seems like unnecessary boilerplate to me. I really don't see why classes derived
from tdesc_element_visitor have to implement methods for nodes they don't care about.
I added Yao in CC so he can chime in.
Simon
next prev parent reply other threads:[~2018-01-29 16:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <a06ab31b-0144-82fe-5d29-4e81016990d3@arm.com>
2018-01-26 15:30 ` Alan Hayward
2018-01-29 2:24 ` Simon Marchi
2018-01-29 9:30 ` Philipp Rudo
2018-01-29 15:31 ` Alan Hayward
2018-01-29 16:13 ` Simon Marchi [this message]
2018-01-29 16:54 ` Yao Qi
2018-01-30 15:16 ` Alan Hayward
2018-02-05 16:21 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=edb69de1-bbbe-bf9f-78c9-c07237338d3c@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=Alan.Hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=nd@arm.com \
--cc=prudo@linux.vnet.ibm.com \
--cc=qiyaoltc@gmail.com \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox