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 条
  • [31] A Survey on Secure Refactoring
    Estomii Edward
    Ally S. Nyamawe
    Noe Elisa
    SN Computer Science, 5 (7)
  • [32] Refactoring in the Presence of Annotations
    Noguera, Carlos
    Kellens, Andy
    De Roover, Coen
    Jonckers, Viviane
    2012 28TH IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE (ICSM), 2012, : 337 - 346
  • [33] On the documentation of refactoring types
    Eman Abdullah AlOmar
    Jiaqian Liu
    Kenneth Addo
    Mohamed Wiem Mkaouer
    Christian Newman
    Ali Ouni
    Zhe Yu
    Automated Software Engineering, 2022, 29
  • [34] Refactoring Module Structure
    Loevei, Laszlo
    Hoch, Csaba
    Koello, Hanna
    Nagy, Tamas
    Vig, Aniko Nagyne
    Horpacsi, Daniel
    Kitlei, Robert
    Kiraly, Roland
    ERLANG '08: PROCEEDINGS OF THE 2008 SIGPLAN ERLANG WORKSHOP, 2008, : 83 - 89
  • [35] RefDistiller: A Refactoring Aware Code Review Tool for Inspecting Manual Refactoring Edits
    Alves, Everton L. G.
    Song, Myoungkyu
    Kim, Miryung
    22ND ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (FSE 2014), 2014, : 751 - 754
  • [36] Test Coverage and Impact Analysis for Detecting Refactoring Faults: A Study on the Extract Method Refactoring
    Alves, Everton L. G.
    Massoni, Tiago
    Machado, Patricia D. L.
    30TH ANNUAL ACM SYMPOSIUM ON APPLIED COMPUTING, VOLS I AND II, 2015, : 1534 - 1540
  • [37] Making Program Refactoring Safer
    Soares, Gustavo
    Gheyi, Rohit
    Serey, Dalton
    Massoni, Tiago
    IEEE SOFTWARE, 2010, 27 (04) : 52 - 57
  • [38] Refactoring Towards a Layered Architecture
    Cornelio, Marcio
    Cavalcanti, Ana
    Sampaio, Augusto
    ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2005, 130 : 281 - 300
  • [39] Refactoring Tools Are Trustworthy Enough
    Brant, John
    IEEE SOFTWARE, 2015, 32 (06) : 80 - +
  • [40] Automated Refactoring to Reactive Programming
    Koehler, Mirko
    Salvaneschi, Guido
    34TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING (ASE 2019), 2019, : 539 - 550