RUS  ENG
Full version
JOURNALS // Proceedings of the Institute for System Programming of the RAS // Archive

Proceedings of ISP RAS, 2015 Volume 27, Issue 2, Pages 53–64 (Mi tisp122)

This article is cited in 2 papers

Analyzing C/C++ code entities and relations for program understanding

A. Belevantsev, E. Velesevich

Institute for System Programming of the Russian Academy of Sciences

Abstract: This paper describes the static analysis tool for finding program entities, their metrics, and relations between entities. Program entities are files/directories (physical structure) and classes/functions/methods/global variables (logical structure). Relations are connections between entities, such as calls, inheritance, aggregation, reading/writing, inclusion. The need for constructing such a tool arises from the program understanding problems. The basis of these problems’ solutions should be automatic extraction of necessary data from program source code. The tool implementing this extraction should support all C/C++ constructs and should scale to millions lines of code to be applicable to real life applications.
In the paper we concentrate on the methods for developing such a tool for C/C++ languages based on open source components: LLVM/Clang compiler infrastructure, GNU Binutils linker and archiver. The final whole-program analysis works on the LLVM internal representation (bitcode) level, so it is necessary to save the additional source level data in the bitcode files that is usually lost during compilation. We have made more than 400 patches to the Clang compiler in order to support this additional data storing and also to support many varieties of C/C++ dialects. For the main analyzer, the central component is a kind of linker that unifies the collected data for the same entities used in different program components (like an application and a library it uses). The correct entities unification performed by the linker allows to trace component relations more precisely.
Finally, we briefly present the results of testing our tool on Android OS.

Keywords: program understanding, LLVM compiler, static analysis, code metrics.

DOI: 10.15514/ISPRAS-2015-27(2)-4



Bibliographic databases:


© Steklov Math. Inst. of RAS, 2024