[Lldb-commits] [lldb] r255598 - Fix Clang-tidy modernize-use-nullptr and readability-simplify-boolean-expr warnings in some files in source/Target/.
Eugene Zelenko via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 15 17:36:53 PST 2015
Hi, Jim!
On Mon, Dec 14, 2015 at 6:10 PM, Jim Ingham <jingham at apple.com> wrote:
> I see the value of replacing NULL with nullptr, but I don't see the value of these sorts of changes:
>
>> On Dec 14, 2015, at 5:33 PM, Eugene Zelenko via lldb-commits <lldb-commits at lists.llvm.org> wrote:
>>
>> @@ -118,19 +111,13 @@ ThreadPlanStepInstruction::IsPlanStale (
>> StackID cur_frame_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
>> if (cur_frame_id == m_stack_id)
>> {
>> - if (m_thread.GetRegisterContext()->GetPC(0) != m_instruction_addr)
>> - return true;
>> - else
>> - return false;
>> + return (m_thread.GetRegisterContext()->GetPC(0) != m_instruction_addr);
>> }
>
> To my eye the second version though more dense, is actually harder to read. I tend to write returns this way because I like it this way. It mirrors the thought process - I'm testing something, then doing something, and makes the various bits of code that do these tests have some uniformity, rather than burying them behind an assignment or return. Moreover, I don't see the point of going through and changing code you didn't write to fit your or clang tidy's preferences. It just sprinkles more random changes into the history that folks doing archeology now have to look past, and makes the code look like it wasn't written by whoever wrote it. I don't see the value in either of these.
>
> Jim
On my personal opinion LLDB as part of LLVM should represent project
as example of best code possible, even if it significantly lags behind
LLVM as of now. I'm trying to help as much as I could. But
concentrating on the past (however good it was) will never allow to do
that.
I don't think that expectation of keeping personal touch is right one
for any big project, especially open source one.
I think it's always good idea to learn good practices from other
people, especially formalized through automated tools.
Eugene.
More information about the lldb-commits
mailing list