]> granicus.if.org Git - clang/commit
[analyzer] Make CloneDetector recognize different variable patterns.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 4 Aug 2016 19:37:00 +0000 (19:37 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 4 Aug 2016 19:37:00 +0000 (19:37 +0000)
commit6c79ae7ac1ae2611cfc486aafba2635ce2471d74
tree772ccd394b7872d1e209feddf759736d7c965471
parentb4e3956f95bfbdd61fe200fa7610b41e0af681a8
[analyzer] Make CloneDetector recognize different variable patterns.

CloneDetector should be able to detect clones with renamed variables.
However, if variables are referenced multiple times around the code sample,
the usage patterns need to be recognized.

For example, (x < y ? y : x) and (y < x ? y : x) are no longer clones,
however (a < b ? b : a) is still a clone of the former.

Variable patterns are computed and compared during a separate filtering pass.

Patch by Raphael Isemann!

Differential Revision: https://reviews.llvm.org/D22982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277757 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/CloneDetection.cpp
test/Analysis/copypaste/false-positives.cpp [deleted file]
test/Analysis/copypaste/functions.cpp