[PATCH] D19311: Self Assignment Checker

Balogh, Ádám via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 01:15:06 PDT 2016

baloghadamsoftware created this revision.
baloghadamsoftware added a reviewer: dcoughlin.
baloghadamsoftware added subscribers: cfe-commits, xazax.hun, o.gyorgy.

This checker checks copy and move assignment operators whether they are protected against self-assignment. Since C++ core guidelines discourages explicit checking for ``&rhs==this`` in general we take a different approach: in top-frame analysis we branch the exploded graph for two cases, where &rhs==this and &rhs!=this and let existing checkers (e.g. unix.Malloc) do the rest of the work. It is important that we check all copy and move assignment operator in top frame even if we checked them already since self-assignments may happen undetected even in the same translation unit (e.g. using random indices for an array what may or may not be the same).



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19311.54324.patch
Type: text/x-patch
Size: 5697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160420/951d79bf/attachment.bin>

More information about the cfe-commits mailing list