[analyzer] Make CloneDetector consider macro expansions.
authorArtem Dergachev <artem.dergachev@gmail.com>
Sat, 20 Aug 2016 10:06:59 +0000 (10:06 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Sat, 20 Aug 2016 10:06:59 +0000 (10:06 +0000)
commit51b9a0e8e8ab7b6ad0458163248035afef08d5b4
tree323bd2abb093df828eddc32b8541d71ae1996845
parent51838888131bdeadbd998c50a141efeb67d73751
[analyzer] Make CloneDetector consider macro expansions.

So far macro-generated code was treated by the CloneDetector as normal code.
This caused that some macros where reported as false-positive clones because
large chunks of code coming from otherwise concise macro expansions were treated
as copy-pasted code.

This patch ensures that macros are treated in the same way as literals/function
calls. This prevents macros that expand into multiple statements
from being reported as clones.

Patch by Raphael Isemann!

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

llvm-svn: 279367
clang/include/clang/Analysis/CloneDetection.h
clang/lib/Analysis/CloneDetection.cpp
clang/test/Analysis/copypaste/macro-complexity.cpp [new file with mode: 0644]
clang/test/Analysis/copypaste/macros.cpp [new file with mode: 0644]