rizsotto / scan-build

Clang's scan-build re-implementation in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support cross translation unit analysis

dkrupp opened this issue · comments

Cross TU analysis feature (to be introduced in this patch: https://reviews.llvm.org/D30691) requires 2 stage analysis: 1st stage: emit ast (clang -emit-ast) for all source files into a a temporary directory (ctu-dir)
2nd stage: invoke clang analysis for each file with the -ctu-dir option so can clang can find the result of the first phase.

In the CTU patch this feature is implemented in the
ctu-build.py and ctu-analyze.py scripts. These scripts reuse scan-build's analyze-cc script.

Reviewers suggested that the whole ctu features should be added to scan-build and then ctu-build.py and ctu-analyze.py scripts could be deleted.


scan-build and anayze-build could be extended withe following options (at least the first should be supported):

--ctu : Perform CTU analysis (1st and 2nd phase), using the default ctu-dir for temporary output. At the end of the analysis, the temporary directory is removed.
--ctu-dir directory: Optional parameter to define the ctu temporary directory
--ctu-first-phase-only: do not perform the analyis phase, only the 1st emit-ast phase
--keep-ctu-dir: do not automatically remove ctu-dir temporary directory after analysis
--ctu-analyze-only: Perform only the 2nd analysis phase. In this mode ctu-dir option is mandatory

So after clearing up, these flags will be implemented in analyze-build:
--ctu: Perform CTU analysis (collect and analyze phase), using the default ctu-dir for temporary output. At the end of the analysis, the temporary directory is removed.
--ctu-dir: Optional parameter to define the ctu temporary directory.
--ctu-collect-only: Do not perform the analyis phase, only the 1st collect phase. Keep temporary ctu-dir for further use.
--ctu-analyze-only: Perform only the 2nd analysis phase. In this mode ctu-dir should be present and will not be removed after analysis.