[cfe-dev] How to perform parallel static analysis in scan-build?

Devin Coughlin via cfe-dev cfe-dev at lists.llvm.org
Fri Jun 3 18:22:47 PDT 2016


> On Jun 3, 2016, at 2:18 PM, E Feng via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> I understand the "make -j10" makes the build phase parallel. However, how do I make the static analysis/html report generation phase parallel as well? Is there such an option in scan-build to do that? I searched the scan-build documentation but could not find such an option. It seems by default, scan-build performs static analysis/html report generation phase in serial mode.

Using make -jN is enough to cause the static analyzer to run in parallel as well. This is because scan-build uses environment variable interposition to replace CC with its own script that pretends to be the compiler. The script first builds each source file with the real compiler and then immediately analyzes it. This means that if ‘make' calls the compiler in parallel on a given set of translation units (which it does with -jN) then the static analyzer will also analyze those translation units in parallel.

For example, when using scan-build to analyze openssl-1.0.0d with ‘make -j10’ I see between 4 and 11 analysis processes running concurrently with ‘ps’.

Devin





More information about the cfe-dev mailing list