Debugging with Clang

╄→гoц情女王★ 提交于 2019-12-04 12:04:20
Ben Gottlieb

Nikita Zhuk has wrapped Clang in a GUI and made it available at http://www.karppinen.fi/analysistool/. Very useful.

  1. Download and extract the clang distribution to some directory. Optionally add this directory to your path, or you can just prepend it's location to the command line later on.
  2. cd to your top level project directory (probably something like cd ~/Documents/yourprojectdirectory)
  3. Tell the clang utility to do a build of your project using your xcode project settings by typing in the following command line: pathtoclangdirectory/scan-build -o ./clang_out xcodebuild
  4. The utilty should give you a message after it has run successfully to run the scan_view utility.
  5. Run the command that was output at the end of the build. This will start a temporary web server on your machine and then open up Safari and show you the code analysis. You may need to prepend the path to your clang directory again, like so: pathtoclangdirectory/scan_view ...
mmc

I didn't see this question until after I had done something similar to make Clang more useful inside XCode:

Using Clang Static Analyzer from within XCode

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