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

Jonathan Sauer jonathan.sauer at gmx.de
Mon Sep 23 01:05:04 PDT 2013


Hello,

>> 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?

>From what I know the analyzer cannot be run at the same time as compiling the
program; you have to do a separate run. This page describes how it's done:
<http://clang-analyzer.llvm.org/scan-build.html>.

Given that the static analyzer is much slower than compilation I don't think
it's wise to run it every time. But you could set it up so it runs e.g. as part
of your unit tests.


HTH,
Jonathan





More information about the cfe-dev mailing list