<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>CCing the list as other people might add suggestions.</div><div><br></div><div>scan-build works by interposing on a build (by setting CC and CCC to a fake compiler, called ccc-analyzer.). If everything works correctly, the build system then uses ccc-analyzer for compiling C and C++ files.  When ccc-analyzer gets invoked, it first invokes the real compiler and then invokes clang for static analysis. scan-build currently only works with make and xcodebuild. (See: <a href="http://clang-analyzer.llvm.org/scan-build.html">http://clang-analyzer.llvm.org/scan-build.html</a>)</div><div><br></div><div><div><div>On Nov 26, 2012, at 2:19 PM, Peeter Joot <<a href="mailto:peeter.joot@gmail.com">peeter.joot@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Anna,<div><br></div><div>In our case, regardless of whether you ever support more than one translation unit, there's effectively no practical way that our project (~7500 source files in a reduced build configuration) would ever be compiled in any other way than our own build system (which is very complex, and non-trivial to modify).  So we are stuck with invoking any analyzer at a file by file basis.</div></blockquote><div><br></div>You should be able to analyze your project by calling clang --analyze on each translation unit. Just keep in mind that this might change in the future (ex: with whole project analyzes).</div><div><br></div><div>It might also possible that you could come up with a simple patch to scan-build which would make it suitable for your build system.<br><br><blockquote type="cite"><div><div>

<br></div><div>If I try scan-build manually on just one file:</div><div><br></div><div>$HOME/tmp/clang/llvm/tools/clang/tools/scan-build/scan-build -o $HOME/tmp/an/ --use-analyzer $HOME/local/bin/clang $HOME/local/bin/clang++ -c [SNIP MANY OPTIONS]  sqle_ca_cmd.C</div>
<div><br></div><div>I end up with no output?  If I debug into ccc-analyzer, I see that it does invoke the compiler, but without adding any options. </div></div></blockquote><blockquote type="cite"><div><div> In particular, it doesn't add: --analyze.  Do I need to both add that to my compilation options and also call scan-build?</div></div></blockquote><br><div>You can look at the Analyze() routine in ccc-analyzer. It does not call "clang --analyze" directly, but calls a lower level "clang -cc1 -analyze <span style="font-family: Monaco; font-size: 11px; ">-analyzer-checker=.."</span><span style="font-size: 13px; "> the command built by scan-build. Unless you specify extra options to scan-build they will be equivalent (scan-build calls clang --analyzer -### to get the equivalent cc1 command).</span></div><div><span style="font-size: 13px; "><br></span></div><blockquote type="cite"><div></div></blockquote><blockquote type="cite"><div>

<div class="gmail_extra"><br>-- <br>Peeter<br>
</div></div>
</blockquote></div><br></div></body></html>