[llvm-dev] [cfe-dev] Cross translational unit analysis in codechecker

Siddharth Shankar Swain via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 22 11:04:52 PDT 2017


Thanks Daniel for the info.
Siddharth

On Thu, Sep 21, 2017 at 10:37 PM, Dániel Krupp <daniel.krupp at ericsson.com>
wrote:

> Hi Siddharth,
>
>
>
> since the CTU functionality is not yet part of the mainline clang (review
> ongoing), you will need to clone our patched version of clang5
>
> https://github.com/Ericsson/clang
>
> (ctu-clang5 branch)
>
>
>
> please use the following llvm commit revision to compile clang:
>
> Branch ctu-clang5 -> LLVM commit 657c31173ea30090583e40c7a9204561d9c2d8c4
>
>
>
> when you compiled clang successfully you should have a
> “clang-func-mapping” binary in the <build_dir>/bin directory.
>
>
>
> Then create a codechecker package as described here
>
> https://github.com/Ericsson/codechecker#linux
>
>
>
> Add <LLVM_BUILD_DIR>/bin to your path e.g.: export
> PATH=<LLVM_BUILD_DIR>/bin:$PATH
>
> so CodeChecker will find this new CTU patched version of clang.
>
>
>
> If all went fine you start CodeChecker analyze –help and it will print:
>
>
>
> cross translation unit analysis arguments:
>
>   These arguments are only available if the Clang Static Analyzer supports
>
>   Cross-TU analysis. By default, no CTU analysis is ran when 'CodeChecker
>
>   analyze' is called.
>
>
>
>   --ctu, --ctu-all      Perform Cross Translation Unit (CTU) analysis, both
>
>                         'collect' and 'analyze' phases. In this mode, the
>
>                         extra files created by 'collect' are cleaned up
> after
>
>                         the analysis.
>
>   --ctu-collect         Perform the first, 'collect' phase of Cross-TU
>
>                         analysis. This phase generates extra files needed
> by
>
>                         CTU analysis, and puts them into '<OUTPUT_DIR>/ctu-
>
>                         dir'. NOTE: If this argument is present,
> CodeChecker
>
>                         will NOT execute the analyzers!
>
>   --ctu-analyze         Perform the second, 'analyze' phase of Cross-TU
>
>                         analysis, using already available extra files in
>
>                         '<OUTPUT_DIR>/ctu-dir'. (These files will not be
>
>                         cleaned up in this mode.)
>
>   --ctu-on-the-fly      If specified, the 'collect' phase will not create
> the
>
>                         extra AST dumps, but rather analysis will be ran
> with
>
>                         an in-memory recompilation of the source files.
>
>
>
> Then you can say to analyze your code:
>
> CodeChecker log -b “make” -o compilation.json
>
> CodeChecker analyze compilation.json –ctu-all -o reports
>
> then print the reports
>
> CodeChecker parse ./reports
>
>
>
> (For more howto see: https://github.com/Ericsson/
> codechecker/blob/master/docs/usage.md)
>
>
>
> I hope this helps.
>
>
>
> Regards,
>
> Daniel
>
>
>
>
>
> *From:* cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] *On Behalf Of *Siddharth
> Shankar Swain via cfe-dev
> *Sent:* 2017. szeptember 20. 16:17
> *To:* Clang Dev <cfe-dev at lists.llvm.org>
> *Subject:* [cfe-dev] Cross translational unit analysis in codechecker
>
>
>
> Hi,
>
> can anyone tell how to use codechecker https://github.com/Ericsson/
> codechecker with cross translational unit analysis flag for analysis
> across translational unit ?
>
> Thanks,
>
> Siddharth
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170922/97b71091/attachment.html>


More information about the llvm-dev mailing list