Apple integrated the Clang Static Analyzer into Xcode a while back. It’s a part of the LLVM project and it uses the clang C/C++/Objective-C compiler front-end to the LLVM compiler to perform static analysis.
The static analyzer (or “clang checker”) is really useful for finding common retain/release errors in Objective-C code. You run the analyzer by building your project using the Build and Analyze item under the Build menu.
When I recently went to run the static analyzer on one of my projects using the recently released iOS 4.1 SDK, I got a series of the following types of errors:
Analyzer skipped this file due to parse errors /var/folders/i9/i9DFseJFFYSMZkTn1Rhbck+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/SeaHawk_Prefix-dowiojzcyzihdsgrlwpnuuxbajci/SeaHawk_Prefix.pch' file not found
The recommended solution is to add the following to Other C Flags in your project’s build settings: -D__IPHONE_OS_VERSION_MIN_REQUIRED=040100 where you replace 040100 with your deployment target version (030200 for 3.2, for example).
Related Articles
- Setting Up Clang Static Analyzer and Xcode (in three steps) (developers.enormego.com)
- Xcode 4 public preview – Single window, LLVM 2.0, streamlined editing (developer.apple.com)
Leave a Reply