[cfe-dev] Libclang static analyzer

Ted Kremenek kremenek at apple.com
Mon Jan 30 11:15:02 PST 2012

Hi Fredrik,

The current answer is no.  We could possibly enhance the analyzer to emit a new serialized format (e.g., bitcode) that can then be read back in via a separate libclang interface.  This is something I'd like to do at some point.  This allows libclang not to link in the analyzer, but does allow it to consume its output.  We recently enhanced libclang to read in serialized compiler diagnostics, so providing a new set of API hooks for reading in analyzer diagnostics would not be bad.  What would be really neat is if we had such a C API in place, this enables the construction of a bunch of rich clients (e.g., via the Python bindings) for analyzer diagnostics.


On Jan 29, 2012, at 1:32 PM, Fredrik Ehnbom wrote:

> Great, I didn't know that.
> Is there anyway to get libclang to spit out a plist or get the
> diagnostics via the libclang api though? On the *nixes it's not a big
> problem, but on Windows libclang.dll is much easier to ship with the
> plugin compared to requiring users to install the full clang
> distribution.
> Thanks
> /f
> 2012/1/29 David Chisnall <csdavec at swan.ac.uk>:
>> The static analyser can export its results in a property list.  The best way of using it from another tool is to do what XCode does - invoke it in a separate process and then read the resulting property list.
>> David
>> On 29 Jan 2012, at 20:10, Fredrik Ehnbom wrote:
>>> Hi,
>>> Is it possible to run the static analyzer and get the diagnostics with libclang?
>>> I'm thinking some command line option could enable it and then you get
>>> the diagnostics, ranges and fixits as usual, but nothing I've tried
>>> seems to do the trick. Am I missing something or is it just not
>>> supported? What would it take to get it to work?
>>> The use case I'm trying to enable is static analyzer support via a
>>> python plugin for a text editor.
>>> Many thanks,
>>> /f
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list