codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

[analyze] [CTU] Add support for pch paramteres of clang-extdef-mapping

Open martong opened this issue 3 years ago • 7 comments

This patch is about supporting https://reviews.llvm.org/D128704 from Clang.

When doing CTU analysis setup we parse the .cpp to get an .ast and then we run clang-extdef-mapping on the .cpp file later. This is sub-optimal since we have to re-parse the file again.

With this patch we can now run clang-extdef-mapping directly on the .ast file. That saves some time.

Fixes https://github.com/Ericsson/codechecker/issues/3703

martong avatar Jul 13 '22 16:07 martong

The overall CSA runtime (with the default profile) improved roughly with 1-2 % in case of C++, and with 0-1% in case of C. image

martong avatar Jul 14 '22 15:07 martong

Ping

martong avatar Jul 22 '22 08:07 martong

Technically it looks good to me, though, it's not clear why relative/absolute paths matter. Maybe it would be worth for a comment about its reasons.

Thanks for the review! Relative/absolute paths matter because the "on-demand" and the "pch" based CTU uses the paths differently. This is documented in ctu_manager.py at the function func_map_list_src_to_ast:

    """ Turns textual function map list with source files into a
    mapping from mangled names to mapped paths, which can be absolute paths to
    the original source files if ctu_on_demand is True, or relative path
    segments to AST-dump files that reside in CTU-DIR directory otherwise. """

martong avatar Jul 27 '22 12:07 martong

Ping

martong avatar Aug 02 '22 15:08 martong

Ping @Szelethus

martong avatar Sep 26 '22 14:09 martong

This absolutely cannot go in without a proper PR description and commit message. Please make the review, and the subsequent archeology easier.

Does this have a corresponding LLVM commit and/or phabricator revision? Is there an issue or something for this? Why do we need this? Whats to gain?

This patch is about supporting https://reviews.llvm.org/D128704 from Clang.

When doing CTU analysis setup we parse the .cpp to get an .ast and then we run clang-extdef-mapping on the .cpp file later. This is sub-optimal since we have to re-parse the file again.

With this patch we can now run clang-extdef-mapping directly on the .ast file. That saves some time.

martong avatar Oct 17 '22 15:10 martong

BTW, the commit message refers to an issue that describes the meaning of this PR: Fixes https://github.com/Ericsson/codechecker/issues/3703

martong avatar Oct 17 '22 15:10 martong