[Lldb-commits] [PATCH] D40821: Fix const-correctness in RegisterContext methods, NFC

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 4 17:43:47 PST 2017


vsk created this revision.
Herald added a subscriber: javed.absar.

A few methods in RegisterContext classes accept const objects which are
cast to a non-const thread_state_t. Instead of dropping const-ness, it
might be simpler and more ergonomic to just not mark the objects const.

This fixes a slew of warnings.

One alternative is to drop const-ness in a C++-friendly way, e.g:

  const_cast<thread_state_t>(static_cast<thread_state_t>(&X))

This would still leave us in a situation where some RegisterContext
methods accept const objects and others don't, and it doesn't seem
feasible to apply const everywhere here, because of non-const methods
like SetRegisterDataFrom_LC_THREAD.


https://reviews.llvm.org/D40821

Files:
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.h
  source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
  source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
  source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
  source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
  source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
  source/Plugins/Process/Utility/RegisterContextMach_arm.h
  source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
  source/Plugins/Process/Utility/RegisterContextMach_i386.h
  source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
  source/Plugins/Process/Utility/RegisterContextMach_x86_64.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40821.125460.patch
Type: text/x-patch
Size: 21985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171205/511fb3ba/attachment-0001.bin>


More information about the lldb-commits mailing list