Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Fix misc-assign-operator-signature when const Type& returned #24238

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR24239
Status NEW
Importance P enhancement
Reported by Eugene Zelenko (eugene.zelenko@gmail.com)
Reported on 2015-07-23 19:31:14 -0700
Last modified on 2018-10-10 07:45:09 -0700
Version unspecified
Hardware All All
CC alexfh@google.com, djasper@google.com, klimek@google.com, sbenza@google.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

I run trunk Clang-tidy against trunk LLDB code which contain a lot of assign operators which return const Type& instead of Type&, but Clang-tidy was not able to fix such code.

Quuxplusone commented 9 years ago

This check doesn't produce fixit hints. I'm not sure whether it can produce fixits for all cases safely. It would need to analyze the implementation of the assignment operator and in some cases its usages.

I also expect this check to fire not extremely frequently, so a fix wouldn't save much time, I guess. But I also may be wrong ;)

Quuxplusone commented 9 years ago
What Alex said. The cost of writing the fixit code was not worth it, at least
for us.
For the 'const T&' case we might be able to do it, since there is already a
return statement. For other return types (void, int, etc) it would be really
hard.
Quuxplusone commented 9 years ago
(In reply to comment #2)
> What Alex said. The cost of writing the fixit code was not worth it, at
> least for us.
> For the 'const T&' case we might be able to do it, since there is already a
> return statement. For other return types (void, int, etc) it would be really
> hard.

There is 156 placed in LLDB code majority of which return const Type&. This
looks worth to try to automate.

Automation may make sense in other code bases.