<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Ying,<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 5, 2018, at 5:24 PM, Yingtong Liu via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">               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" class="">-Xclang </span>-analyzer-checker=checker_name test.c</div><div class=""><br class=""></div><div class="">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 class=""></div><div>If the issue is simply invoking the linker, then you can do:</div><div><br class=""></div><div>> clang -Xclang -analyze <span class="" 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-checker=checker_name -fsyntax-only test.c</div><div><br class=""></div><div>OR</div><div><br class=""></div><div><div>> clang —analyze -Xclang -analyze <span class="" 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-checker=checker_name test.c</div><div class=""><br class=""></div><div class="">(note the double dash before “analyze”)</div><div class=""><br class=""></div><div class="">I think both should work.</div></div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">When I added -cc1 option, using it like this way,</div><div class=""><br class=""></div><div class="">                clang -cc1 -analyze -analyzer-checker=xxx test.c<br class=""></div><div class=""><br class=""></div><div class="">The error is gone, but I have to include all the default compiler headers manually, which I don't wanna do.</div><div class=""><br class=""></div><div class="">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 class=""><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div style="font-size:small" class=""><span style="font-size:12.8px" class="">Thanks,</span></div><div style="font-size:small" class=""><span style="font-size:12.8px" class="">Ying</span></div></div></div></div>
</div></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></body></html>