[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...
Size: 5697 bytes
Desc: not available
More information about the cfe-commits