<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 4, 2017, at 6:02 PM, Zachary Turner <<a href="mailto:zturner@google.com" class="">zturner@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">It almost looks to me like this should be using aggregation instead of inheritance.  That would add a 3rd option (mark it mutable).</div></blockquote><div><br class=""></div><div>I don't have my head wrapped around your suggestion. Do you mean that 'const GPR &' and friends should be made mutable members of RegisterContext?</div><div><br class=""></div><div>thanks,</div><div>vedant</div><br class=""><blockquote type="cite" class=""><div class="">  That said, nothing wrong with using this approach either <br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Dec 4, 2017 at 5:43 PM Vedant Kumar via Phabricator via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">vsk created this revision.<br class="">
Herald added a subscriber: javed.absar.<br class="">
<br class="">
A few methods in RegisterContext classes accept const objects which are<br class="">
cast to a non-const thread_state_t. Instead of dropping const-ness, it<br class="">
might be simpler and more ergonomic to just not mark the objects const.<br class="">
<br class="">
This fixes a slew of warnings.<br class="">
<br class="">
One alternative is to drop const-ness in a C++-friendly way, e.g:<br class="">
<br class="">
  const_cast<thread_state_t>(static_cast<thread_state_t>(&X))<br class="">
<br class="">
This would still leave us in a situation where some RegisterContext<br class="">
methods accept const objects and others don't, and it doesn't seem<br class="">
feasible to apply const everywhere here, because of non-const methods<br class="">
like SetRegisterDataFrom_LC_THREAD.<br class="">
<br class="">
<br class="">
<a href="https://reviews.llvm.org/D40821" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/D40821</a><br class="">
<br class="">
Files:<br class="">
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp<br class="">
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.h<br class="">
  source/Plugins/Process/Utility/RegisterContextDarwin_arm.h<br class="">
  source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h<br class="">
  source/Plugins/Process/Utility/RegisterContextDarwin_i386.h<br class="">
  source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h<br class="">
  source/Plugins/Process/Utility/RegisterContextMach_arm.cpp<br class="">
  source/Plugins/Process/Utility/RegisterContextMach_arm.h<br class="">
  source/Plugins/Process/Utility/RegisterContextMach_i386.cpp<br class="">
  source/Plugins/Process/Utility/RegisterContextMach_i386.h<br class="">
  source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp<br class="">
  source/Plugins/Process/Utility/RegisterContextMach_x86_64.h<br class="">
<br class="">
_______________________________________________<br class="">
lldb-commits mailing list<br class="">
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank" class="">lldb-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>