Since there is no Xcode script variable for "current project directory," how can you create a script menu item to run the Clang Static Analyzer on your current project from Xcode?
From the XCode script menu item, "Edit User Scripts" enter the following script:
Obviously, you will need to adjust the path to your install of Clang, and adjust to the version of the SDK you are using. Remember to do a "Clean All" immediately before using scan-build, or the results may be incomplete. | |||||||
feedback
|
nice script found @ http://allancraig.net/blog/?p=381 | |||
feedback
|
FYI, Xcode 3.2 (Snow Leopard only I believe) includes the Clang Static Analyzer in the "Build and Analyze" menu option. http://iphonedevelopertips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html One downside of Xcode 3.2 (aside from it only working on Snow Leopard) is that the v2.x Simulators don't seem to work - in fact, I've seen posts indicating that v2.x builds are not supported at all. | |||
feedback
|
I believe the ${PROJECT_DIR} environment variable is what you want for the directory of the project running a build-phase script. | |||||||
feedback
|