<div dir="ltr">I'd personally say that making the rewriter more complex by making the methods virtual is not worth it. My design vote would go for decoupling through a facade in the client code.<br></div><br><div class="gmail_quote">On Fri, May 15, 2015 at 5:01 AM Eli Bendersky <<a href="mailto:eliben@google.com">eliben@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 14, 2015 at 7:13 PM, Manasij Mukherjee <span dir="ltr"><<a href="mailto:manasij7479@gmail.com" target="_blank">manasij7479@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If you mean to call the base methods anyway, wouldn't it be better to have a Rewriter object as a member of your class ?</div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>It is certainly possible to wrap Rewriter in another class. But this would mean the code needs to:</div><div><br></div><div>1. Replace Rewriter* everywhere with the new class</div><div>2. Implement all of Rewriter's methods to call base methods + additional operations</div><div><br></div><div>This is quite cumbersome. Making some methods of Rewriter virtual, however, would mean (1) is not needed and in (2) we only need to override methods we instrument/modify.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Eli</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, May 14, 2015 at 12:20 PM, Eli Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi,<div><br></div><div>Would there be objections to make clang::Rewriter a bit friendlier for subclassing by marking some of its methods virtual? In particular InsertText, ReplaceText, RemoveText and their variations.</div><div><br></div><div>The reason for this is to be able to subclass Rewriter for the purposes of logging, debugging and other custom capabilities.</div><div><br></div><div>If this sounds reasonable, I'll be happy to implement this.</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Eli<br></div></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>