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

Laszlo Nagy rizsotto.mailinglist at gmail.com
Mon Jun 17 06:55:05 PDT 2013


you can use bear <https://github.com/rizsotto/Bear> to get the compilation
database... if you use linux/freebsd/osx, it works with scons.

regards,
Laszlo


On Mon, Jun 17, 2013 at 12:47 PM, Manuel Klimek <klimek at google.com> wrote:

> On Mon, Jun 17, 2013 at 10:24 AM, Michele Galante <
> m.galante at centrosistemi.it> wrote:
>
>> 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?
>>
>
> If you can somehow create a compilation database (cmake and ninja
> currently can do so, adding support for scons shouldn't be too hard -
> http://clang.llvm.org/docs/JSONCompilationDatabase.html), you can use
> $ clang-check -analyze path/to/my/file.cpp
>
> Cheers,
> /Manuel
>
>
>>
>>  Michele Galante
>> Direzione Tecnica
>> Laboratorio delle Idee
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130617/b0a06ba4/attachment.html>


More information about the cfe-dev mailing list