Is it possible to get static analyzer fixits via libclang?


Is it possible to get the fixits that clang-tidy can produce, but via libclang?

I tried adding the --analyze option when creating the translation unit, but I don’t see any static analyser warnings and only fixit I have seen so far is to add missing semi colon.

Thanks in advance


Static analyzer doesn't currently produce fixits, because classes of bugs it finds ("path-sensitive" bug reports that take a lot of different source code locations into account, such as memory leak paths or null dereference paths) are quite different in nature from normal warnings issued by the compiler or lint tools like clang-tidy, and most of them are very hard to reasonably fix automatically.

The analyzer also doesn't work when the translation unit has errors, which seems to be your case (missing semicolon?).

I'd also hint that using the scan-build tool instead of adding --analyze manually is usually easier for bigger projects.

Thanks for the reply, my usage scenario is for ide integration rather than an end user. I understand that not all checks emit visits, but for those that do how does xcode capture this information?