<div dir="ltr">Hi Ted,<div><br></div><div>Thanks for the help! I actually have a follow-up question, though. This question came up because I was toying around with developing my own simple checker and wanted to test it out. My first inclination was to do this in isolation from the other checkers which is why I attempted the invocation from my original post, but perhaps you're saying that even for a dev situation like this just run the whole platter of checkers? Or, did you just mean for a general usage scenario where someone isn't adding new checkers etc.?</div>
<div><br></div><div>I just ended up using --analyze because the scan-build command I could figure out was somewhat more verbose, needing --use-analyzer=... etc.; but, I was mostly fumbling around trying to get it to work, so I'm sure I'm missing a bunch of different things.</div>
<div><br></div><div>Thanks again.</div><div><br></div><div>-Mike</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 25, 2014 at 11:00 AM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Michael,<br>
<br>
It’s not recommended to run the low-level driver like this. You can just use scan-build, for example:<br>
<br>
$ scan-build clang -c /tmp/main.c<br>
<br>
or more generally<br>
<br>
$ scan-build <compiler line><br>
<br>
You can also use:<br>
<br>
$ clang —analyze /tmp/main.c<br>
<br>
directly. That’s somewhat discouraged because the long-term idea is that the static analyzer supports global analysis. The intention is that you can declare a set of files to analyze and they get analyzed together, whereas the latter line is clearly just analyzing a particular file using clang.<br>
<br>
Cheers,<br>
Ted<br>
<div><div class="h5"><br>
On Feb 21, 2014, at 2:22 PM, Michael Katelman <<a href="mailto:katelman@gmail.com">katelman@gmail.com</a>> wrote:<br>
<br>
> I was wondering if someone might be able to help me with cleanly invoking a single analyzer from the static analysis tools.<br>
><br>
> I am not sure what I need to do (or, should be doing instead) in a situation like the one below where I've got a header like stdio.h included (--analyze figures it out, but then it appears that I lose the ability to apply a single checker) :<br>
><br>
> % ./Debug+Asserts/bin/clang -cc1 -analyze -analyzer-checker=core.DivideZero ./tmp/main.c<br>
><br>
> ./tmp/main.c:1:10: fatal error: 'stdio.h' file not found<br>
> #include <stdio.h><br>
> ^<br>
> 1 error generated.<br>
><br>
> % cat ./tmp /main.c<br>
><br>
> #include <stdio.h><br>
><br>
> int main( int argc, char** argv){<br>
> int x = 1;<br>
> int y = 0;<br>
><br>
> printf("%d\n", x / y);<br>
><br>
> return 0;<br>
> }<br>
><br>
> Thanks!<br>
><br>
> -Mike<br>
</div></div>> _______________________________________________<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>