[PATCH] D23314: [analyzer] CloneDetector allows comparing clones for suspicious variable pattern errors.

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 06:45:41 PDT 2016

teemperor created this revision.
teemperor added reviewers: v.g.vassilev, NoQ, zaks.anna.
teemperor added subscribers: cfe-commits, vsk.

One of the goals of the project was to find bugs caused by copy-pasting, which happen when a piece of code is copied but not all variables in this piece of code are correctly adapted to the new environment (e.g. like this 'if (mutex1.try_lock()) { foo(); mutex2.unlock(); }' where the mutex2 variable is a leftover from the original source code).

This patch adds support vor analyzing the pattern of the referenced variables for similar errors. So far only 'one-off' errors are supported, i.e. pattern errors where only one variable is not following the pattern of its related clones.

Additionally, the CloneChecker - which is currently the primary user of the CloneDetector API - now also supports reporting these suspicious clones.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23314.67324.patch
Type: text/x-patch
Size: 20991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160809/413bb110/attachment-0001.bin>

More information about the cfe-commits mailing list