This is an archive of the discontinued LLVM Phabricator instance.

[NFC][Clang] Fix Static Code Analysis Concerns with copy without assign
ClosedPublic

Authored by Manna on May 18 2023, 9:03 PM.

Details

Summary

This patch adds missing assignment operator to the class which has user-defined copy constructor.

Diff Detail

Event Timeline

Manna created this revision.May 18 2023, 9:03 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: steakhal. · View Herald Transcript
Manna requested review of this revision.May 18 2023, 9:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2023, 9:03 PM
Manna updated this revision to Diff 523649.May 18 2023, 9:23 PM

Can only comment on ThreadSafetyTIL.h. Thanks for addressing this, I agree that these expressions should not be assignable.

clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
323–324

We can probably even drop the comment. Types in an inheritance hierarchy tend to be not assignable, and I don't see why it would ever be needed for what amounts to be AST nodes.

387–389

My understanding is that deleting copy assignment on the base class automatically deletes it for the derived classes, so I'd appreciate if we could drop this and the following additions. That's just noise in my view.

Also, most of these classes don't seem to have a user-declared copy constructor, or am I missing something?

Manna updated this revision to Diff 523957.May 19 2023, 4:06 PM

I have addressed review comments.

Manna marked 2 inline comments as done.May 19 2023, 4:09 PM
Manna added inline comments.
clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
323–324

Thank you @aaronpuchert for reviews and feedbacks.

I have dropped the comment.

387–389

Yup, Sounds reasonable to me. Removed

Manna updated this revision to Diff 524044.May 20 2023, 10:14 AM
Manna marked 2 inline comments as done.

I have updated patch to resolve build errors.

Changes to ThreadSafetyTIL.h look good to me, thanks!

Manna added a comment.May 20 2023, 5:31 PM

Changes to ThreadSafetyTIL.h look good to me, thanks!

Thank you @aaronpuchert for reviews!

Manna retitled this revision from [NFC][Clang][Coverity] Fix Static Code Analysis Concerns with copy without assign to [NFC][Clang] Fix Static Code Analysis Concerns with copy without assign.May 25 2023, 9:52 AM
tahonermann accepted this revision.Jun 22 2023, 10:44 AM

These changes look fine to me.

This revision is now accepted and ready to land.Jun 22 2023, 10:44 AM

Thank you @tahonermann and @aaronpuchert for reviews and comments!