HeaderSplit: An Automated Tool for Splitting Header Files in C Projects

Yue Wang, Jiaxuan Sun, Tongwei Deng, Wenhui Chang, Yanzhen Zou, Bing Xie · 2025

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.

Read the paper · More papers on PaperTik