[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)
commit7a0088bbae10f867a842b02d3e49047b3c350d35
treef3d5583185fb439e8e1b2b09cecfc4149c926ffe
parentc8acb4f37b95b1eb7b633c9ccf7c42ea54531297
[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

llvm-svn: 277757
clang/lib/Analysis/CloneDetection.cpp
clang/test/Analysis/copypaste/false-positives.cpp [deleted file]
clang/test/Analysis/copypaste/functions.cpp