<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="font-size:small">Thanks George. Worked. </div></div></div></div><div class="gmail_quote">On Tue, Feb 6, 2018 at 3:54 PM, George Karpenkov <span dir="ltr"><<a href="mailto:ekarpenkov@apple.com" target="_blank">ekarpenkov@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;line-break:after-white-space">Hi Ying,<br><div><span class=""><br><blockquote type="cite"><div>On Feb 5, 2018, at 5:24 PM, Yingtong Liu via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="m_-1048007493201915803Apple-interchange-newline"><div><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></div></blockquote><div><br></div></span><div>If the issue is simply invoking the linker, then you can do:</div><div><br></div><div>> clang -Xclang -analyze <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-variant-ligatures:normal;background-color:rgb(255,255,255);float:none;display:inline">-Xclang </span>-analyzer-<wbr>checker=checker_name -fsyntax-only test.c</div><div><br></div><div>OR</div><div><br></div><div><div>> clang —analyze -Xclang -analyze <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-variant-ligatures:normal;background-color:rgb(255,255,255);float:none;display:inline">-Xclang </span>-analyzer-<wbr>checker=checker_name test.c</div><div><br></div><div>(note the double dash before “analyze”)</div><div><br></div><div>I think both should work.</div></div><div><br></div><blockquote type="cite"><div><span class=""><div dir="ltr"><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_-1048007493201915803gmail_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></span><span class="">
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/cfe-dev</a><br></span></div></blockquote></div><br></div></blockquote></div><br></div></div>