Abstract | ||
---|---|---|
This paper establishes the concept of \"preprocessor dependences\" as a foundation for building automated refactoring tools that transform source code containing lexical macros and conditional compilation directives, such as those provided by the C preprocessor. We define a preprocessor dependence graph (PPDG) that models the relationships among macro definitions, macro invocations, and conditional compilation directives in a file--the relationships that must be maintained for the semantics of the C preprocessor to be preserved. For many refactorings, a tool can construct a PPDG from the code before and after it is transformed, then perform a linear-time comparison of the two graphs to determine whether the refactoring will operate correctly in the presence of macros and conditional compilation directives. The proposed technique was implemented in OpenRefactory/C and tested by applying refactorings to GNU Coreutils version 8.21. Empirical results indicate that the technique is effective; it successfully handled refactoring scenarios in which Eclipse CDT, Visual Assist X, and XRefactory all refactored code incorrectly. |
Year | DOI | Venue |
---|---|---|
2014 | 10.1145/2635868.2635908 | SIGSOFT FSE |
Keywords | Field | DocType |
refactoring,formal definitions and theory,processors,automatic programming,c,preprocessor | Programming language,Computer science,Source code,Preprocessor,Conditional compilation,Eclipse,Macro,Code refactoring,Semantics,Translation unit (programming) | Conference |
Citations | PageRank | References |
3 | 0.38 | 20 |
Authors | ||
3 |
Name | Order | Citations | PageRank |
---|---|---|---|
Jeffrey L. Overbey | 1 | 29 | 4.22 |
Farnaz Behrang | 2 | 52 | 5.01 |
Munawar Hafiz | 3 | 224 | 15.40 |