[cfe-dev] Clang 3.3: --analyze produces object file full of XML (plist)

Jeffrey Walton noloader at gmail.com
Mon Sep 23 00:38:58 PDT 2013


On Mon, Sep 23, 2013 at 2:42 AM, Jonathan Sauer <jonathan.sauer at gmx.de> wrote:
> Hello,
>
>> This is even easier to duplicate:
>>
>> $ touch event.c
>> ...
>> $ cat event.c
>> #include <stdio.h>
>> int main(int argc, char* argv[]) {
>>
>>    return !argc;
>> }
>>
>> $ /usr/local/bin/clang --analyze event.c -o event.exe
>> $ file event.exe
>> event.exe: XML document text
>> $
>
> As far as I know when running the static analyzer (which --analyze does) clang outputs
> an XML or HTML file with the analyzer's result, not machine code. So I would guess
> everything works as intended.
Thanks Jonathon. (Don't I feel like an ass....).

That sounds a lot like what I do with scan-build to get the HTML pages.

> What is the result you expect?
Well, I wanted to invoke the analyzer while building the library (or
in this case, compiling a source file). I wanted the results to go to
stdout (its easier to file bug reports based on the findings).

$ /usr/local/bin/clang --analyze -analyzer-output stdout t.c -o t.exe
clang: warning: argument unused during compilation: '-analyzer-output stdout'

So I guess I should ask: how do I run the analyzer, build the object
files, and print the analyzer's results to the terminal?

Jeff



More information about the cfe-dev mailing list