Tuesday, March 13, 2012

Adding a New Clang Checker

Create a file with checker, e.g. by making a copy of some other. Make sure you leave ClangSACheckers.h include in your checker.

Next, you need to add an entry to CMakeLists.txt and Checkers.td. Without that, you will not have your checker built or listed in clang checkers list respectively.

You may hit this build error:
error: 'void clang::ento::register...Checker(clang::ento::CheckerManager&)' should have been declared inside 'clang::ento'

In that case, check that you have ClangSACheckers.h included and that you did not misspelled filename in the two files above.

If the compilation is successful, you should see your checker in the clang checker list generated by:
clang -cc1 -analyzer-checker-help

No comments: