[Lldb-commits] [PATCH] D40821: Fix const-correctness in RegisterContext methods, NFC
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 4 18:36:17 PST 2017
Admittedly I was on mobile when I wrote that so I didn't have code to look
at. I assumed from the pattern and the few function signatures I saw that
GPR etc were inheriting from thread_state_t, and that was how the cast
worked at all. A quick look at the code suggests this is not the case
On Mon, Dec 4, 2017 at 6:08 PM Vedant Kumar <vsk at apple.com> wrote:
> On Dec 4, 2017, at 6:02 PM, Zachary Turner <zturner at google.com> wrote:
> It almost looks to me like this should be using aggregation instead of
> inheritance. That would add a 3rd option (mark it mutable).
> 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?
> That said, nothing wrong with using this approach either
> On Mon, Dec 4, 2017 at 5:43 PM Vedant Kumar via Phabricator via
> lldb-commits <lldb-commits at lists.llvm.org> wrote:
>> 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:
>> 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.
>> lldb-commits mailing list
>> lldb-commits at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-commits