This is an archive of the discontinued LLVM Phabricator instance.

Fix range-loop-analysis checks for trivial copyability
AcceptedPublic

Authored by fanfuqiang on Dec 9 2020, 11:28 AM.

Diff Detail

Event Timeline

fanfuqiang requested review of this revision.Dec 9 2020, 11:28 AM
fanfuqiang created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2020, 11:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Quuxplusone added inline comments.
clang/test/SemaCXX/warn-range-loop-analysis.cpp
35

I recommend adding ID1(ID1 const&) = default; here. My understanding is that C++20 has deprecated auto-generating a defaulted copy constructor for a class with a user-defined copy-assignment operator. See -Wdeprecated-copy.

478

Isn't the point of https://bugs.llvm.org/show_bug.cgi?id=48011 that there should be no warning for for (ID1 x : C) {}? There is already no warning for the const& case tested here.

This comment was removed by fanfuqiang.
fanfuqiang retitled this revision from Fix https://bugs.llvm.org/show_bug.cgi?id=48011 to Fix range-loop-analysis checks for trivial copyability.Dec 10 2020, 5:06 AM
fanfuqiang set the repository for this revision to rG LLVM Github Monorepo.
fanfuqiang marked 2 inline comments as done.

update testcase take advise of reviewers.
fix conflict testcase fail, less warnning only for hasNonTrivialCopyConstructor .

gandhi21299 added a subscriber: gandhi21299.EditedFeb 25 2021, 9:52 PM

I tried to implement a fix by using the hasCopyAssignmentWithConstParam() method (instead of hasNonTrivialCopyConstructor()), the test trivially-copyable.cc fails due to a missing warning.

gandhi21299 accepted this revision.Nov 21 2021, 2:39 PM

LGTM, thanks for the bug fix!

This revision is now accepted and ready to land.Nov 21 2021, 2:39 PM

What ever happened to this patch? @fanfuqiang, are you still around to rebase this? Do you need someone to commit it for you?
(Not that I'm saying I think it's perfect as is — I haven't looked and don't know the code that well — but just wondering what kept this from being landed a year ago.)

The bug it fixes is now https://github.com/llvm/llvm-project/issues/47355

@Quuxplusone I can commit this patch on behalf of @fanfuqiang.

Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 9:42 AM

Perhaps, a description could be added to this patch before committing.