This is an archive of the discontinued LLVM Phabricator instance.

Applying clang-tidy modernize-use-equals-default over LLDB
ClosedPublic

Authored by shafik on Mar 16 2022, 1:47 PM.

Details

Summary

Applied modernize-use-equals-default clang-tidy check over LLDB.

This check is already present in the lldb/.clang-tidy config.

Diff Detail

Event Timeline

shafik created this revision.Mar 16 2022, 1:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2022, 1:47 PM
shafik requested review of this revision.Mar 16 2022, 1:47 PM

We sure do have a lot of CommandOptions classes out there.

lldb/source/Core/Value.cpp
667 ↗(On Diff #415958)

I have to look into why we return a const & here. We do this in a few other places too.

This revision is now accepted and ready to land.Mar 16 2022, 3:02 PM
labath accepted this revision.Mar 17 2022, 2:02 AM
labath added inline comments.
lldb/source/Core/Value.cpp
667 ↗(On Diff #415958)

I don't think there's a good reason for that. Most people aren't aware that built-in assignment operators return lvalues. And some of the people who are aware of that think that it's a bad idea, so they make sure their operators don't do it...

lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp
16–17

Why suppress this?

lldb/source/Target/ExecutionContext.cpp
415–416

You may need to manually delete this line to get sensible clang-formatting.

(Please run clang-format before submitting)

shafik marked 2 inline comments as done.Mar 29 2022, 2:11 PM
shafik added inline comments.
lldb/source/Core/Value.cpp
667 ↗(On Diff #415958)

It produced build errors, so some of the users are relying on this. I didn't want to plumb into this since it was orthogonal to the change.

lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp
16–17

I wanted to preserve the comment since someone thought it was important.

labath added inline comments.Mar 30 2022, 12:17 AM
lldb/source/Core/Value.cpp
667 ↗(On Diff #415958)

I was curious to see what kind of errors could be produced by that change -- I didn't get any, so I committed (c484857b2e77721a4235b0e2d53d335c09fc6af3) my version. :)

lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp
16–17

In that case, maybe you can just put the comment next to the =default clause. Now, this is beginning to look like there is something very subtle going on -- subtle enough to confuse the clang-tidy check. Which, of course, isn't true...

shafik marked 3 inline comments as done.Mar 30 2022, 8:40 PM
shafik added inline comments.
lldb/source/Core/Value.cpp
667 ↗(On Diff #415958)

I see that, I am not sure what I did wrong that I got a bunch of errors the other day.

shafik updated this revision to Diff 419550.Mar 31 2022, 1:05 PM
shafik marked 2 inline comments as done.
  • Rebased
  • Applied clang-format
  • Address Pavel's comment
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 1:22 PM