HeaderSplit: An Automated Tool for Splitting Header Files in C Projects
Developers often need to refactor bloated code files that have accumulated multiple responsibilities over time, typically by splitting a large code file into several smaller ones. Existing works, primarily focusing on class file decomposition, often fail to split header files as they seldom consider build dependencies of the system and cannot ensure acyclic dependencies among the decomposed files. In this work, we propose HeaderSplit, an automated tool designed specifically for splitting header files in C projects. It first suggests a decomposition plan based on multi-view graph clustering and cyclic dependencies fixing heuristics, showing the code elements in each new file and the "include" relationships among the files. Upon user approval, HeaderSplit automatically executes the refactoring, generating new header files and updating the include statements in all code files that directly or transitively include the original header file. Implemented as a VS Code extension, Header-Split has been evaluated on real-world projects, showing improved cohesion, reduction in recompilation, and ensured acyclic dependencies, all within acceptable time limits. The tool is available at https://github.com/wangyue0502/HeaderSplit. The demonstration video can be found at https://youtu.be/QXi-emXkdzk.
Authors
- Yanzhen Zou (ORCID: https://orcid.org/0009-0009-1764-6645)
- Tongwei Deng
- Yue Wang (ORCID: https://orcid.org/0009-0007-7116-0086)
- Jianjun Sun (ORCID: https://orcid.org/0000-0001-5780-5334)
- Wenhui Chang
- Bing Xie (ORCID: https://orcid.org/0000-0002-2988-2575)
Institutions
- Peking University (CN)
Publication Details
- Published
- 2025-06-23
- DOI
- https://doi.org/10.1145/3696630.3728594
- Citations
- 1
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 3.25
Funders
- National Key Research and Development Program of China