doris icon indicating copy to clipboard operation
doris copied to clipboard

[Enhancement] clean be include header

Open JackDrogon opened this issue 2 years ago • 1 comments

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

JackDrogon avatar Feb 13 '23 08:02 JackDrogon

现在工作目录创建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

JackDrogon avatar Feb 13 '23 08:02 JackDrogon

Ive been assigned this issue. Where would I find the "be often" header files?

Raulj123 avatar Mar 14 '23 16:03 Raulj123

I want to solve the problem

tanghw9827 avatar Jun 05 '23 02:06 tanghw9827