This is an archive of the discontinued LLVM Phabricator instance.

[libfuzzer] avoid self-assgin in Command
AbandonedPublic

Authored by yingcong-wu on Mar 13 2023, 1:15 AM.

Details

Reviewers
vitalybuka
Summary

Add test to avoid self-assgin in fuzzer::Command

Diff Detail

Event Timeline

yingcong-wu created this revision.Mar 13 2023, 1:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 1:15 AM
Herald added a subscriber: Enna1. · View Herald Transcript
yingcong-wu requested review of this revision.Mar 13 2023, 1:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 1:15 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Hi all, kindly ping.

vitalybuka accepted this revision.Mar 20 2023, 1:36 PM
This revision is now accepted and ready to land.Mar 20 2023, 1:36 PM
vitalybuka requested changes to this revision.Mar 20 2023, 1:44 PM

Actually in this case self assignment looks like not a problem. If it's so it's recommended not to a check one. string and bool is safe to self assign. Did I miss something?

This revision now requires changes to proceed.Mar 20 2023, 1:44 PM

Yes, for now, this class is safe to do self-assign. But I think it is best to avoid doing that for it has no benefit doing so.

Yes, for now, this class is safe to do self-assign. But I think it is best to avoid doing that for it has no benefit doing so.

Here the reasoning. This one is not performance critical, but I don't see a point to break the rule.
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c62-make-copy-assignment-safe-for-self-assignment

yingcong-wu abandoned this revision.Mar 23 2023, 8:30 PM

Yes, for now, this class is safe to do self-assign. But I think it is best to avoid doing that for it has no benefit doing so.

Here the reasoning. This one is not performance critical, but I don't see a point to break the rule.
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c62-make-copy-assignment-safe-for-self-assignment

A good & solid reason, I will abandon this patch then.