一句话:提出 HeaderSplit,基于多视图图聚类与循环依赖修复自动拆分 C 头文件并更新 include,作为 VS Code 扩展实现。
C 项目中头文件常因职责累积而变得臃肿,但现有文件拆分工作主要面向类文件,很少考虑构建依赖,也无法保证拆分后文件间依赖无环。本文提出 HeaderSplit,一个专门用于拆分 C 项目头文件的自动化工具。它首先基于多视图图聚类与循环依赖修复启发式给出拆分方案,展示每个新文件包含的代码元素及文件间的 include 关系;经用户确认后,自动生成新头文件,并更新所有直接或传递包含原头文件的代码中的 include 语句。该工具实现为 VS Code 扩展,并在真实项目上评估,结果显示内聚性提升、重编译减少且依赖无环,运行时间可接受。
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.
@inproceedings{paperbot9054,
title = {HeaderSplit: An Automated Tool for Splitting Header Files in C Projects},
author = {Yue Wang and Jiaxuan Sun and Tongwei Deng and Wenhui Chang and Yanzhen Zou and Bing Xie},
booktitle = {FSE},
year = {2025},
doi = {10.1145/3696630.3728594}
}