Refactoring on the whole project.
Refactoring is one of the most popular and successful techniques for improving source code. It is an integral part of agile development methods. However, C/C++ developers still lack effective tools for source code automatic refactoring. It is obviously a serious limitation when refactoring is applicable only to a single translation unit. In many cases applying refactoring to the only source file with its headers may cause errors when linking the whole software project. This article describes in details how whole project (global) refactoring can be implemented on basis of an existing single unit refactoring tool. Special attention is paid here to refactoring «Rename» as it is one of the most widely used transformations applicable to the whole project. Two important problems specific for global renaming are highlighted. First, the article describes a way of matching two different identifiers used in different translation units. Second, a problem of minimizing the number of local renamings required for the given global renaming is also discussed. It is displayed that using a database containing information about identifiers used in a project and positions of those identifiers in project sources can significantly increase the speed of global renaming.
Proceedings of the Institute for System Programming, vol. 26, issue 1, 2014, pp. 395-402.
ISSN 2220-6426 (Online), ISSN 2079-8156 (Print).