This is an archive of the discontinued LLVM Phabricator instance.

PR12214 - warn on suspicious self-compound-assignments
ClosedPublic

Authored by nikola on May 13 2014, 10:53 PM.

Details

Reviewers
rsmith
Summary

http://llvm.org/bugs/show_bug.cgi?id=12214

How about something as simple as this? Note that labels in the switch are no longer sorted but this isn't the only place.

Diff Detail

Event Timeline

nikola updated this revision to Diff 9373.May 13 2014, 10:53 PM
nikola retitled this revision from to PR12214 - warn on suspicious self-compound-assignments.
nikola updated this object.
nikola edited the test plan for this revision. (Show Details)
nikola added a reviewer: rsmith.
rsmith edited edge metadata.May 22 2014, 5:16 PM

This approach looks good. Patch needs testcases :)

Are you happy with the message or should we go for something more specific mentioning bitwise operators?

nikola updated this revision to Diff 9791.May 25 2014, 6:37 PM
nikola edited edge metadata.
nikola added a subscriber: Unknown Object (MLST).

Now with tests.

rsmith accepted this revision.May 29 2014, 4:25 PM
rsmith edited edge metadata.

Maybe tweak the diagnostic (for both this case and the normal self-assignment case) to:

explicitly assigning value of variable of type %0 to itself

(Adding the 'value of' makes this message work better for the compound-assignment case.)

Other than that, LGTM

This revision is now accepted and ready to land.May 29 2014, 4:25 PM
nikola closed this revision.May 29 2014, 5:23 PM

Done in r209867.