Abstract:
This article describes the methods of code clones detection. New approach of code clones detection is proposed for C/C++ languages based on analysis of existed methods. The method based on semantic analysis of the project, which allows detecting code clones with high accuracy. It is realized as part of LLVM compiler, which allows exceeding existed methods. The tool is consisted of three basic parts. The first part is Program Dependence Graph (PDG) generation and serialization. PDG is constructed during compilation time of the project based on LLVM's intermediate representation. Several simple optimizations are applied on these graphs, then they are serialized to file. The second stage is analyzing of stored PDGs. PDGs are loaded from files and split to subgraphs. Every subgraph is considered as clone candidate. New method is purposed for the splitting, which increases number of detected clones. There are two types of algorithms for clone detection. The first types of algorithms try to prove that the pair of PDGs can not be clones. These algorithms have linear complexity, which allows processing huge amount of PDGs pairs. In case of failure graph isomorphism algorithms are applied for similar subgraphs detection. The last part is integrated system for automatic testing of algorithm’s accuracy. For the project, set of clones are automatically generated, then clone detection algorithms are applied for original source and generated one
This publication is cited in the following 4 articles:
E. V. Zavadskii, A. V. Bulat, N. A. Gribkov, “Method of Searching for Clones of the Program Code in Binary Executive Files”, Aut. Control Comp. Sci., 58:8 (2024), 1263
A. K. Aslanyan, Sh. F. Kurmangaleev, V. G. Vardanyan, M. S. Arutyunyan, S. S. Sargsyan, “Platformenno-nezavisimyi i masshtabiruemyi instrument poiska klonov koda v binarnykh failakh”, Trudy ISP RAN, 28:5 (2016), 215–226
Arutyun Avetisyan, Shamil Kurmangaleev, Sevak Sargsyan, Mariam Arutunian, Andrey Belevantsev, 2015 Computer Science and Information Technologies (CSIT), 2015, 100