doris
doris copied to clipboard
[Enhancement] clean be include header
Search before asking
- [X] I had searched in the issues and found no similar issues.
Description
Doris be often compiles very long . Through the analysis found that many times is included irrelevant header triggered.
Solution
Use iwyu to remove unused headers.
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
现在工作目录创建iwyu目录,然后使用find导出所有文件列表到iwyu/files_list,然后就可以使用iwyu-patch 从1到n 挨个一个个文件进行清理,关于这些需要挨个文件commit。因为iwyu会过度清理,需要有些添加iwyu guard.
下面是iwyu-patch的示例脚本
#!/bin/bash
num=$1
filename=$(sed "${num}q;d" ./iwyu/files_list)
shortname=$(echo $filename | awk -F/ '{print $NF}')
iwyu_outfile="./iwyu/${shortname}.iwyuout"
build_dir=build_Release
echo $filename $shortname $iwyu_outfile
iwyu_tool.py -p $build_dir $filename > $iwyu_outfile
fix_includes.py --comments --update_comments -b < $iwyu_outfile
Ive been assigned this issue. Where would I find the "be often" header files?
I want to solve the problem