Making new checker visible in the Clang's Static Analyzer

感情迁移 提交于 2020-01-17 06:07:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!