<div dir="ltr">Hi Artem,<div><br></div><div>Thank you for your explaination. It makes sense. </div><div><br></div><div>Best,</div><div>Yingtong</div><div class="gmail_extra">
<br><div class="gmail_quote">On Tue, Feb 6, 2018 at 1:03 PM, Artem Dergachev <span dir="ltr"><<a href="mailto:noqnoqneo@gmail.com" target="_blank">noqnoqneo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That's right, you cannot analyze and compile in a single clang instance. I don't remember why it was designed this way, but i don't think anybody is planning to fix it.<br>
<br>
* It'd be much more scary to work on the analyzer if we had a chance to cause code generation failures after our work is done, or if you'd be unable to compile without tweaking your build system when the analyzer is crashing.<br>
* In particular, we're sometimes enjoying the ability to modify the AST (eg. do the "body farms" thing).<br>
* We have the fancy __clang_analyzer__ macro that hides code from the analyzer without affecting compilation.<br>
* Very often the project is compiled with a different compiler anyway.<br>
* Anyway, compilation time is usually very small compared to analysis time, so doing two compilations is not going to make things much slower.<span class=""><br>
<br>
On 06/02/2018 9:55 AM, Yingtong Liu via cfe-dev wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Thank you Aleksei, it worked to run the checkers.<br>
<br>
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?<br>
<br>
Best,<br>
Yingtong<br>
<br>
--<br>
Ph.D<br>
Computer Science Department<br>
University of California, Irvine<br>
<br></span><div><div class="h5">
On Tue, Feb 6, 2018 at 1:34 AM, Aleksei Sidorin <<a href="mailto:a.sidorin@samsung.com" target="_blank">a.sidorin@samsung.com</a> <mailto:<a href="mailto:a.sidorin@samsung.com" target="_blank">a.sidorin@samsung.com</a>><wbr>> wrote:<br>
<br>
    Hello,<br>
<br>
    It looks like clang is thinking that he has to compile the file<br>
    because the default behaviour was not changed via cmdline options.<br>
    Could you try:<br>
<br>
    clang --analyze -Xclang -analyzer-checker=checker_name test.c<br>
<br>
    ? --analyze will tell clang that he doesn't need to produce<br>
    binary, only to analyze the file.<br>
<br>
<br>
    06.02.2018 04:24, Yingtong Liu via cfe-dev пишет:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
    Hi,<br>
<br>
    I am trying to use clang static checker from command line. I knew<br>
    there are two ways to do that. One is using scan-build command,<br>
    which works fine for me. But I need to use the checker in another<br>
    way, which is from the official website, like:<br>
<br>
                   clang -Xclang -analyze -Xclang<br>
    -analyzer-checker=checker_name test.c<br>
<br>
    This reported me /usr/bin/ld: cannot find /tmp/xxx.o: File format<br>
    not recognized. It seems like the xxx.o file never being<br>
    generated using this command line.<br>
<br>
    When I added -cc1 option, using it like this way,<br>
<br>
                    clang -cc1 -analyze -analyzer-checker=xxx test.c<br>
<br>
    The error is gone, but I have to include all the default compiler<br>
    headers manually, which I don't wanna do.<br>
<br>
    My question is, what's the right way to pass the checker to clang<br>
    to get the bug report and the built file at the same time?<br>
<br>
    Thanks,<br>
    Ying<br>
<br>
<br>
    ______________________________<wbr>_________________<br>
    cfe-dev mailing list<br></div></div>
    <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><wbr>><br>
    <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
    <<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin<wbr>/mailman/listinfo/cfe-dev</a>><br>
</blockquote><span class="">
<br>
<br>
    --     Best regards,<br>
    Aleksei Sidorin,<br>
    SRR, Samsung Electronics<br>
<br>
<br>
<br>
<br>
______________________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</span></blockquote>
<br>
</blockquote></div><br></div></div>