[cfe-dev] Clang Static Analyzer without scan-build

Michele Galante m.galante at centrosistemi.it
Mon Jun 17 01:24:42 PDT 2013


I would like to use the Clang Static Analyzer in our projects but I'm having some difficulties in figuring out how to integrate it in our build systems.

We currently use SCons to build our projects. We develop firmware for embedded systems, so a single project usually builds executables for different targets using different toolchains. In addition, the SCons script will build the unit tests using the host system compiler in order to run them on the host.

At the moment we are using PC-Lint to perform static analysis. This tool can be used like a typical compiler. You can compile a single source file to a (sort of) object file, the object files can be grouped in libraries, object files and libraries can be linked to a (sort of) final executable. During the compilation the tool analyzes the single source file in isolation, during the link it does some inter-module analysis. This approach fits very well with our build system, because we can use the lint tool like any other toolchain.

I understand that Clang Static Analyzer is driven by the scan-build script. This script substitutes calls to the compiler with calls to the static analyzer by acting on the typical build variables like CC. This approach does not work with our build system, because we do not use any external build variable but instead the build script will explicitly select different toolchains while building programs for different targets.

Is there a (documented) way to use Clang Static Analyzer directly without the scan-build script?

Michele Galante
Direzione Tecnica
Laboratorio delle Idee

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130617/38849c11/attachment.html>


More information about the cfe-dev mailing list