So im completely new to this llvm project and i been trying to play with the static analyzer checkers to see if i can create one of my own even if its a simple one. I been analyzing the division by zero and kinda understand how it works but i like to know how does one go about adding a new checker and making it appear in “clang -cc1 -analyzer-checker-help” because i did what the developer manual said but it did not work. And if anyone has any tips for a beginner on how to get started with llvm/clang it would be nice.
Thanks in advance.
See CloneChecker example which is added by- https://reviews.llvm.org/rL276782.
And its commit history:- https://github.com/llvm/llvm-project/commits/master/clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp.
You have to add a TableGen entry for your checker in clang/include/clang/StaticAnalyzer/Checkers/Checkers.td.
Thanks, for the help.
Another quick question, the makefile that I have to run for the checker to work is it the one located in this directory?
Yes, See the first commit of other checkers’ implementation.
Normally you need four files.
Thanks, got it working correctly