Since that's what the guidelines require.
Fixes #63733
Paths
| Differential D155625
[clang-tidy] Warn only for copyable/movable classes in cppcoreguidelines-avoid-const-or-ref-members ClosedPublic Authored by carlosgalvezp on Jul 18 2023, 10:18 AM.
Details Summary Since that's what the guidelines require. Fixes #63733
Diff Detail
Event TimelineComment Actions LGTM, but I'm not sure if isCopyableOrMovable will always work correctly, for a user defined special members it looks ok, but for some implicit ones I worry it may not always work. Probably things like "(hasSimpleCopyAssigment()) || (hasUserDeclaredCopyAssigment() && check here if its not deleted)" would be needed.
This revision is now accepted and ready to land.Jul 18 2023, 1:11 PM Comment Actions
Yeah I spent a lot of time trying to figure this out, somehow I expected this logic to already exist somewhere in Sema! Thanks for the pointers, I will experiment with those functions as well.
Comment Actions Using hasSimpleCopyConstructor and so on greatly simplifies the logic, great! Let me know if you are happy with it or I should go ahead and merge.
This revision was landed with ongoing or failed builds.Jul 19 2023, 5:06 AM Closed by commit rGb70e6e968192: [clang-tidy] Warn only for copyable/movable classes in cppcoreguidelines-avoid… (authored by carlosgalvezp). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 541626 clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidConstOrRefDataMembersCheck.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-const-or-ref-data-members.rst
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/avoid-const-or-ref-data-members.cpp
|
Check first type, should be cheaper and consider mering those two.