You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2020/03/30 16:43:00 UTC

[jira] [Commented] (IMPALA-9371) Run include-what-you-use on all patches

    [ https://issues.apache.org/jira/browse/IMPALA-9371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17071130#comment-17071130 ] 

Tim Armstrong commented on IMPALA-9371:
---------------------------------------

I did a proof-of-concept and added some scripts to run IWYU. This JIRA is now about making it part of the Impala precommit, either as a bot that just comments about best practices, or as a hard precommit check.

Kudu already does something like this.

> Run include-what-you-use on all patches
> ---------------------------------------
>
>                 Key: IMPALA-9371
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9371
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Infrastructure
>            Reporter: Tim Armstrong
>            Priority: Major
>              Labels: ramp-up
>         Attachments: iwyu.sh, iwyu2.txt, iwyu4.txt, iwyu_mappings.imp
>
>
> Impala compile times are longer than necessary because .cc files pull in a lot of headers, especially from the standard C++ library and boost. I looked at the preprocessor output for a couple of files, and it included ~400,000 lines of code, almost entirely from headers.
> include-what-you-use is a tool that can identify cases where header includes can be avoided or moved from .h to .cc files to reduce the number of extraneous headers pulled into each compile unit.
> Kudu has some tooling to run IWYU in a dev environment and also in their gerrit precommit.
> I was able to run iwyu against Impala as follows:
> {code:bash}
> # Clone repo and check out branch to match Impala toolchain's clang version
> git clone https://github.com/include-what-you-use/include-what-you-use.git
> cd include-what-you-use
> git checkout clang_5.0
> # Build IWYU against clang from toolchain
> cmake -G "Unix Makefiles" -DIWYU_LLVM_ROOT_PATH=/opt/Impala-Toolchain/llvm-5.0.1-p2/ -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ..
> make -j $(nproc)
> IWYU_BUILD_DIR=$(pwd)
> # Run IWYU on the impala codebase.
> cd $IMPALA_HOME
> # Do an ASAN build to force Impala to generate compile_commands.json with compile commands suitable for clang.
> ./buildall.sh -noclean -notests -asan
> # Placeholder for additional arguments to the iwyu tool
> IWYU_ARGS=""
> PATH=$IWYU_BUILD_DIR:$PATH ~/repos/include-what-you-use/iwyu_tool.py -p . -j $(nproc) -- $IWYU_ARGS > iwyu.txt
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org