问题
I have included the following code in llvm/tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
file under
let ParentPackage = CoreAlpha in{
...
def SimpleFunc: Checker<"SimpleFunc">,
HelpText<"Simple Function Checking">,
DescFile<"SimpleFunc.cpp">;
But when I am checking its presence after successful compilation by typing the following command, the checker is not visible.
clang -cc1 -analyzer-checker-help
I don't know what's the reason, hope someone could help me regarding this.
回答1:
I can't say much without looking at source file,but I can think of two possibilities. First, you might be missing something like
void ento::registerSimpleFunc(CheckerManager &mgr) {
mgr.registerChecker<SimpleFunc>();
}
in the SimpleFunc.cpp as this is what will register the checker.
Secondly, you might have forgotten to add SimpleFunc.cpp in the CMakeLists.txt so that SimpleFunc.cpp gets compiled and registered.
来源:https://stackoverflow.com/questions/37778269/making-new-checker-visible-in-the-clangs-static-analyzer