A Foundation for Refactoring C with Macros

被引:2
|
作者
Overbey, Jeffrey L. [1 ]
Behrang, Farnaz [1 ]
Hafiz, Munawar [1 ]
机构
[1] Auburn Univ, Dept Comp Sci & Software Engn, Auburn, AL 36849 USA
来源
22ND ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (FSE 2014) | 2014年
关键词
Refactoring; C; Preprocessor;
D O I
10.1145/2635868.2635908
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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 (CPP). 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.
引用
收藏
页码:75 / 85
页数:11
相关论文
共 50 条
  • [21] Stepwise Refactoring Tools
    Eilertsen, Anna Maria
    Murphy, Gail C.
    2021 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE AND EVOLUTION (ICSME 2021), 2021, : 629 - 633
  • [22] JDeodorant: Clone Refactoring
    Mazinanian, Davood
    Tsantalis, Nikolaos
    Stein, Raphael
    Valenta, Zackary
    2016 IEEE/ACM 38TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING COMPANION (ICSE-C), 2016, : 613 - 616
  • [23] Introducing Records by Refactoring
    Loevei, Laszlo
    Zoltan Horvath
    Kozsik, Tamas
    Roland Kiraly
    ERLANG'07: PROCEEDINGS OF THE 2007 SIGPLAN ERLANG WORKSHOP, 2007, : 18 - 28
  • [24] Refactoring middleware with aspects
    Zhang, C
    Jacobsen, HA
    IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, 2003, 14 (11) : 1058 - 1073
  • [25] Refactoring pattern matching
    Wang, Meng
    Gibbons, Jeremy
    Matsuda, Kazutaka
    Hu, Zhenjiang
    SCIENCE OF COMPUTER PROGRAMMING, 2013, 78 (11) : 2216 - 2242
  • [26] A Refactoring Approach to Parallelism
    Dig, Danny
    IEEE SOFTWARE, 2011, 28 (01) : 17 - 22
  • [27] Measuring the effect of refactoring
    Pitt, R
    Carmichael, A
    OOIS 2000: 6TH INTERNATIONAL CONFERENCE ON OBJECT ORIENTED INFORMATION SYSTEMS, PROCEEDINGS, 2001, : 401 - 406
  • [28] Refactoring in Computational Notebooks
    Liu, Eric S.
    Lukes, Dylan A.
    Griswold, William G.
    ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2023, 32 (03)
  • [29] Alloy as a Refactoring Checker?
    Estler, H. -Christian
    Wehrheim, Heike
    ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2008, 214 : 331 - 357
  • [30] On the documentation of refactoring types
    AlOmar, Eman Abdullah
    Liu, Jiaqian
    Addo, Kenneth
    Mkaouer, Mohamed Wiem
    Newman, Christian
    Ouni, Ali
    Yu, Zhe
    AUTOMATED SOFTWARE ENGINEERING, 2022, 29 (01)