Using an external Xcode Clang Static Analyzer binary, with additional checks

旧城冷巷雨未停 提交于 2019-12-03 03:59:37

Upon further investigation, it seems the best way to do this is to use a couple of entries in the Target Build Info, rather than the set-xcode-analyzer command line tool.

Add a User-defined setting, CC, containing the full path to the newer build of the binary, as follows (note that the /bin/clang on the end of the path):

CC = /Path/To/Folder/With/Clang/checker-244/bin/clang

Then in the Other Warning Flags entry add as many of the additional checks as you want, as follows:

WARNING_CFLAGS = -Xanalyzer -analyzer-check-llvm-conventions -Xanalyzer -analyzer-check-objc-missing-dealloc

Each is preceded by the argument -Xanalyzer which indicates that the next argument should be passed to the analyzer.

More on this can be found here: Mac OS X Developer Tools Manual Page.

Then, when you do a Build and Analyze in Xcode you should be using the external, newer binary running the additional checks.

The accepted answer no longer works (Xcode 4)

The format of Xcode's build file means you have to do it like this:

WARNING_CFLAGS = "-Xanalyzer -analyzer-check-llvm-conventions -analyzer-check-objc-missing-dealloc"

NB: the quotes surrounding the entire XAnalyzer phrase.

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