Debugging with Clang

痞子三分冷 提交于 2019-12-06 04:21:53

问题


I'd like to use clang on my Xcode iPhone project. However this is the getting started guide:

http://clang.llvm.org/get_started.html

I've been working with Xcode for a year but this is far far far from being understandable to me! Can anyone explain in plain english how to install and use Clang with my existing iPhone project? I am not familiar with loading things from the console.

Thanks!

Dan


回答1:


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




回答2:


  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 ...



回答3:


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



来源:https://stackoverflow.com/questions/577702/debugging-with-clang

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