This revision was automatically updated to reflect the committed changes.
Closed by commit rL319939: Fix const-correctness in RegisterContext methods,
NFC (authored by vedantk).
Changed prior to commit:
https://reviews.llvm.org/D40821?vs=125639=125774#toc
Repository:
rL LLVM
vsk updated this revision to Diff 125639.
vsk edited the summary of this revision.
vsk added a comment.
- Address Greg's comments.
https://reviews.llvm.org/D40821
Files:
source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
clayborg added a comment.
In https://reviews.llvm.org/D40821#945379, @vsk wrote:
> 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
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
clayborg added a comment.
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?
https://reviews.llvm.org/D40821
___
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 Dec 4, 2017, at 6:02 PM, Zachary Turner 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 &'
It almost looks to me like this should be using aggregation instead of
inheritance. That would add a 3rd option (mark it mutable). 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
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