ci: integrate iwyu checks - #240
Open
kilinchange wants to merge 1 commit into
Open
kilinchange wants to merge 1 commit into
kilinchange wants to merge 1 commit into
Conversation
kilinchange
force-pushed
the
style/iwyu
branch
4 times, most recently
from
September 24, 2026 06:44
82d9600 to
b2cf6e1
Compare
kilinchange
force-pushed
the
style/iwyu
branch
2 times, most recently
from
September 24, 2026 16:50
7a0e165 to
f7f3075
Compare
JYMiracle305
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
引入 Include What You Use(IWYU)检查,用于规范 C/C++ 代码中的头文件依赖,减少隐式依赖和不必要的 include,提升代码依赖关系的可维护性。
主要改动
新增 IWYU GitHub Actions workflow:
compile_commands.json;新增
scripts/iwyu.py:--fix-dry-run预览自动修复结果;--fix调用 IWYU 修复工具自动调整 include;新增
scripts/iwyu.imp:Eigen/Dense;新增
docs/iwyu.md:检查范围
CI 使用 CPU-only 编译配置,关闭 CUDA、NCCL 和 OpenMP 等非必要依赖,并基于生成的 compilation database 执行 IWYU。
当前主要检查以下目录中的 C/C++ translation unit:
infini_trainexampleteststoolsCUDA translation unit 暂不纳入 IWYU 检查。
头文件不会单独作为 translation unit 执行 IWYU,而是通过引用它们的源文件间接完成检查。
third-party 源码不会作为检查目标,但项目代码引用 third-party header 时,IWYU 仍可能在分析过程中解析相关头文件。
自动修复
CI 仅执行 IWYU 检查,不自动修改源码。
本地可通过以下命令预览自动修复结果: