<div dir="ltr">Thank you Aleksei, it worked to run the checkers.<div><br></div><div>It seems like clang can't run the checker and do the compiling at the same time, meaning in one cmd? Just passing the -analyze option and allowing clang to compile the file will report ld error like I said before. Is that ture? </div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="font-size:small"><span style="font-size:12.8px">Best,</span></div><div style="font-size:small" dir="ltr"><span style="font-size:12.8px">Yingtong</span></div><div style="font-size:small" dir="ltr"><span style="font-size:12.8px"></span><span style="font-size:12.8px"><br></span></div><div style="font-size:small" dir="ltr"><span style="font-size:12.8px">--</span></div><div style="font-size:small"><span style="font-size:12.8px">Ph.D</span></div><div style="font-size:small"><span style="font-size:12.8px">Computer Science Department</span></div><div style="font-size:small"><span style="font-size:12.8px">University of California, Irvine</span></div></div></div></div>
<br><div class="gmail_quote">On Tue, Feb 6, 2018 at 1:34 AM, Aleksei Sidorin <span dir="ltr"><<a href="mailto:a.sidorin@samsung.com" target="_blank">a.sidorin@samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_833815735493570124moz-cite-prefix">Hello,<br>
<br>
It looks like clang is thinking that he has to compile the file
because the default behaviour was not changed via cmdline options.
Could you try:<br>
<br>
clang --analyze <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">-Xclang </span>-analyzer-checker=<wbr>checker_name
test.c<br>
<br>
? --analyze will tell clang that he doesn't need to produce
binary, only to analyze the file.<br>
<br>
<br>
06.02.2018 04:24, Yingtong Liu via cfe-dev пишет:<br>
</div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">Hi,
<div><br>
</div>
<div>I am trying to use clang static checker from command line.
I knew there are two ways to do that. One is using scan-build
command, which works fine for me. But I need to use the
checker in another way, which is from the official website,
like:</div>
<div><br>
</div>
<div> clang -Xclang -analyze <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">-Xclang </span>-analyzer-checker=<wbr>checker_name
test.c</div>
<div><br>
</div>
<div>This reported me /usr/bin/ld: cannot find /tmp/xxx.o: File
format not recognized. It seems like the xxx.o file never
being generated using this command line. </div>
<div><br>
</div>
<div>When I added -cc1 option, using it like this way,</div>
<div><br>
</div>
<div> clang -cc1 -analyze -analyzer-checker=xxx
test.c<br>
</div>
<div><br>
</div>
<div>The error is gone, but I have to include all the default
compiler headers manually, which I don't wanna do.</div>
<div><br>
</div>
<div>My question is, what's the right way to pass the checker to
clang to get the bug report and the built file at the same
time?</div>
<div><br clear="all">
<div>
<div class="m_833815735493570124gmail_signature">
<div dir="ltr">
<div style="font-size:small"><span style="font-size:12.8px">Thanks,</span></div>
<div style="font-size:small"><span style="font-size:12.8px">Ying</span></div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="m_833815735493570124mimeAttachmentHeader"></fieldset>
<br>
</div></div><pre>______________________________<wbr>_________________
cfe-dev mailing list
<a class="m_833815735493570124moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a class="m_833815735493570124moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<p><br>
</p>
<pre class="m_833815735493570124moz-signature" cols="72">--
Best regards,
Aleksei Sidorin,
SRR, Samsung Electronics
</pre>
</font></span></div>
</blockquote></div><br></div>