<div dir="ltr">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 class="gmail_extra">
<div class="gmail_quote"><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 style>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">http://clang.llvm.org/docs/JSONCompilationDatabase.html</a>), you can use</div>
<div style>$ clang-check -analyze path/to/my/file.cpp</div><div style><br></div><div style>Cheers,</div><div style>/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 style="word-wrap:break-word"><span class=""><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>_______________________________________________<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></div>