[PATCH] D22982: [CloneDetector] No longer reporting clones that don't have a common referenced variable pattern.
Raphael Isemann via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 29 17:12:11 PDT 2016
teemperor created this revision.
teemperor added reviewers: v.g.vassilev, NoQ, zaks.anna.
teemperor added a subscriber: cfe-commits.
One of the current false-positives the CloneDetector produces is that the statements `a < b ? b` and `b < a ? b` are considered clones of each other, even though they represent two different kinds of algorithms. The reason for this is that the StmtDataCollector ignores variable names when collecting data, so that two clones that only differ in the names of the referenced variables are considered clones. The pattern in which they are referenced however is not taken into aspect so far and causes the mentioned false-positive.
This patch introduces a filter that removes clones which don't have the same variable pattern which prevents these kinds of false-positives.
It should be noted that this is intentionally done after the clones are grouped together by their collected data vector because another planned feature will find clones that explicitly violate the variable patterns of each other.
https://reviews.llvm.org/D22982
Files:
lib/Analysis/CloneDetection.cpp
test/Analysis/copypaste/false-positives.cpp
test/Analysis/copypaste/var-patterns.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22982.66138.patch
Type: text/x-patch
Size: 8529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160730/8d786df4/attachment-0001.bin>
More information about the cfe-commits
mailing list