<div dir="ltr"><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="font-size:12.8px">I don’t think it’s possible. The way scan-build invokes is by invoking clang twice - once for compilation and once for analysis</div></blockquote><div><br></div><div>Uggh. That seems awfully silly? And actually, it's not compatible with cl.exe, which runs /analyze alongside compilation, and prints warnings to the console.</div><div><br></div><div>Is there some reason for that? I imagine that it'd be easier for all users to simply invoke clang once to compile and analyze.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:12.8000001907349px">Sincerely,</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Alexander Riccio</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">--</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">"Change the world or go home."</span><div style="font-size:12.8000001907349px"><a href="http://about.me/ariccio" target="_blank">about.me/ariccio</a></div><div style="font-size:12.8000001907349px"><a href="http://about.me/ariccio" target="_blank"><br></a></div><div style="font-size:12.8000001907349px">If left to my own devices, I will build more.</div><div style="font-size:12.8000001907349px">⁂</div></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Dec 29, 2015 at 4:10 PM, Anna Zaks <span dir="ltr"><<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Dec 27, 2015, at 11:45 PM, <Alexander G. Riccio> <<a href="mailto:alexander@riccio.com" target="_blank">alexander@riccio.com</a>> <Alexander G. Riccio> wrote:</div><br><div><div dir="ltr">Ahh, that makes sense.<div><br></div><div>On a slightly related note, is there a way to run Clang's static analysis as part of compilation WITHOUT scan-build? </div></div><div class="gmail_extra"><br clear="all"></div></div></blockquote><div><br></div></span><div>I don’t think it’s possible. The way scan-build invokes is by invoking clang twice - once for compilation and once for analysis.</div><div><div class="h5"><div><br></div><blockquote type="cite"><div><div class="gmail_extra"><div><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Sincerely,<br>Alexander Riccio<br>--<br>"Change the world or go home."<div><a href="http://about.me/ariccio" target="_blank">about.me/ariccio</a></div><div><a href="http://about.me/ariccio" target="_blank"><br></a></div><div>If left to my own devices, I will build more.</div><div>⁂<br></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Sun, Dec 27, 2015 at 10:55 PM, Anna Zaks <span dir="ltr"><<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">When you call clang with “--analyze”, the driver is only going analyze your program with static analysis; it is not going to fully compile or link it. This explains why you do not see the linker error.<div><br></div><div>Cheers,</div><div>Anna.<br><div><blockquote type="cite"><div><div><div>On Dec 21, 2015, at 3:12 PM, via cfe-dev <Alexander G. Riccio> wrote:</div><br></div></div><div><div><div><div dir="ltr">When I try to build a simple C program (attached), <font face="monospace, monospace">clang-cl</font> warns about some - unrelated to this question - linking issue:<div><br></div><div><div><font face="monospace, monospace">C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl basically_flawed_c_program.c</font></div><div><font face="monospace, monospace">basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external symbol malloc referenced in function main</font></div><div><font face="monospace, monospace">basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external symbol free referenced in function main</font></div><div><font face="monospace, monospace">LINK : error LNK2001: unresolved external symbol mainCRTStartup</font></div><div><font face="monospace, monospace">C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\libcmt.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'</font></div><div><font face="monospace, monospace">basically_flawed_c_program.exe : fatal error LNK1120: 3 unresolved externals</font></div><div><font face="monospace, monospace">clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see invocation)</font></div><div><br></div></div><div>...but when I pass <font face="monospace, monospace">--analyze</font> to <font face="monospace, monospace">clang-cl</font>, it shuts up entirely:</div><div><br></div><div><div><font face="monospace, monospace">C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl --analyze basically_flawed_c_program.c</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">C:\Users\Alexander Riccio\Documents\basically_flawed_c_program></font></div></div><div><br></div><div><br></div><div>What's going on here??</div><div><br></div><div>I'm more interested in why the <font face="monospace, monospace">--analyze</font> flag shuts <font face="monospace, monospace">clang-cl</font> up, than I am the strange linker error; but bonus points if you know what's going on there too.</div><div><br></div><div>I'm also attaching the verbose invocations of the two commands.</div><div><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Sincerely,<br>Alexander Riccio<br>--<br>"Change the world or go home."<div><a href="http://about.me/ariccio" target="_blank">about.me/ariccio</a></div><div><a href="http://about.me/ariccio" target="_blank"><br></a></div><div>If left to my own devices, I will build more.</div><div>⁂<br></div></div></div></div></div></div></div>
</div></div>
</div></div><span><clang-cl-verbose-invoke.txt></span><span><basically_flawed_c_program.c></span>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>
</div></blockquote></div></div></div><br></div></blockquote></div><br></div>