How to implement "--fix" for a checker in Static Analyzer?

Hi,

I am a newbie in LLVM/Clang world. I started looking into Clang a month back for a class project.

I am using Clang from Windows and was able to build it with MSVS 2013. I was also able to add custom checkers to the Static Analyzers.

As per my understanding, the Static Analyzer can be invoked in 3 ways from the command line -

  1. clang -cc1 -analyze -analyzer-checker=xxxx

  2. scan-build utility

  3. clang-check tool

I want to implement code fixer for my custom checker which would be invoked only if option “-fix” is present at input.

I was able to figure out the interfaces to implement for the code replacements. But, I couldn’t understand how to implement it in my custom_checker.cpp.

I want to use scan-build because it generates intuitive HTML reports. But, scan-build doesn’t accept the option “–fix”, does it?

Is the best way to do this is using libTooling?

Any suggestions / guidance is appreciated.

Thanks,

Pradnya