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

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 5 11:00:42 PST 2017


vsk added a comment.

In https://reviews.llvm.org/D40821#945314, @clayborg wrote:

> Seems wrong to remove the const on structs that don't need to change in order to make the write happen. Can't we just quiet the warnings with a const_cast inside the function call?


Absolutely. I opted for dropping const to make the DoRead* and DoWrite* methods feel consistent. At first glance, it looked like there may be methods in RegisterContext which expect non-const GPR/FPU/etc objects, so it seemed reasonable to drop const.

I'm open to just adding in the const_cast<X>(static_cast<const X>(...)) pattern as needed to suppress warnings, and to constifying the rest of RegisterContext as a follow-up. Let me know what you'd prefer.


https://reviews.llvm.org/D40821





More information about the lldb-commits mailing list