<div dir="ltr">you can use bear <<a href="https://github.com/rizsotto/Bear">https://github.com/rizsotto/Bear</a>> to get the compilation database... if you use linux/freebsd/osx, it works with scons.<div><br></div><div style>
regards,</div><div style>Laszlo</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 17, 2013 at 12:47 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="h5">On Mon, Jun 17, 2013 at 10:24 AM, Michele Galante <span dir="ltr"><<a href="mailto:m.galante@centrosistemi.it" target="_blank">m.galante@centrosistemi.it</a>></span> wrote:<br>
</div></div><div class="gmail_extra">
<div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">

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.<div><br></div><div>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.</div>

<div><br></div><div>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.</div>

<div><br></div><div>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.</div>

<div><br></div><div>Is there a (documented) way to use Clang Static Analyzer directly without the scan-build script?</div></div></blockquote><div><br></div></div></div><div>If you can somehow create a compilation database (cmake and ninja currently can do so, adding support for scons shouldn't be too hard - <a href="http://clang.llvm.org/docs/JSONCompilationDatabase.html" target="_blank">http://clang.llvm.org/docs/JSONCompilationDatabase.html</a>), you can use</div>

<div>$ clang-check -analyze path/to/my/file.cpp</div><div><br></div><div>Cheers,</div><div>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">
<div style="word-wrap:break-word"><span><font color="#888888"><div><br><div>
<div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-wrap:break-word;word-spacing:0px">

<span style="font-size:10pt;font-weight:bold;color:rgb(0,72,132);font-family:Arial,Helvetica,sans-serif">Michele Galante<br></span><span style="font-family:Times"></span><span style="font-size:8pt;font-family:Arial,Helvetica,sans-serif;font-weight:bold;color:rgb(0,72,132)">Direzione Tecnica<br>

Laboratorio delle Idee</span></div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-wrap:break-word;word-spacing:0px">

<br></div></div></div></font></span></div><br></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>