[analyzer] Add a modular constraint system to the CloneDetector
A big part of the clone detection code is functionality for filtering clones and clone groups based on different criteria. So far this filtering process was hardcoded into the CloneDetector class, which made it hard to understand and, ultimately, to extend. This patch splits the CloneDetector's logic into a sequence of reusable constraints that are used for filtering clone groups. These constraints can be turned on and off and reodreder at will, and new constraints are easy to implement if necessary. Unit tests are added for the new constraint interface. This is a refactoring patch - no functional change intended. Patch by Raphael Isemann! Differential Revision: https://reviews.llvm.org/D23418 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299544 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Analysis/CloneDetection.h 239 additions, 110 deletionsinclude/clang/Analysis/CloneDetection.h
- lib/Analysis/CloneDetection.cpp 368 additions, 519 deletionslib/Analysis/CloneDetection.cpp
- lib/StaticAnalyzer/Checkers/CloneChecker.cpp 69 additions, 31 deletionslib/StaticAnalyzer/Checkers/CloneChecker.cpp
- unittests/Analysis/CMakeLists.txt 3 additions, 2 deletionsunittests/Analysis/CMakeLists.txt
- unittests/Analysis/CloneDetectionTest.cpp 110 additions, 0 deletionsunittests/Analysis/CloneDetectionTest.cpp
This diff is collapsed.
unittests/Analysis/CloneDetectionTest.cpp
0 → 100644
Please register or sign in to comment