[cfe-commits] [patch] new clang-analyzer checker that verifies ObjC API usage in UIViewController subclasses [v2]

Jordan Rose jordan_rose at apple.com
Tue Oct 23 09:58:11 PDT 2012


Hi, Julian. Sorry for not getting back to you right away. I had a few comments stashed away for your checker, but I got sidetracked by the fact that it will eventually be obsolete with the new 'objc_requires_super' attribute. I don't know if you've followed the list, but that attribute (for methods) will effectively do the same check, but as a compiler warning.

However, there hasn't been a release of the Cocoa and Cocoa Touch frameworks with this attribute in all the right places, so your checker is still useful. I'll put some comments for the actual patch on Phabricator (http://llvm-reviews.chandlerc.com/D68).

Thanks for working on this!
Jordan


On Oct 22, 2012, at 14:18 , Julian Mayer <julian at corecode.at> wrote:

> hello
> 
> attached is a new clang-analyzer checker that verifies ObjC API usage in UIViewController subclasses, more specifically if implemented methods correctly call the superclass implementations in methods where this is mandatory (and omitting these calls can lead to real and difficult-to-find bugs).
> 
> the code is largely based on the dealloc checker which includes the check for a missing super call as part its functions.
> 
> the code currently only checks UIViewController subclasses but should be extended to be more general in the future, there are a variety of classes in the iOS and Mac OS X APIs that require some methods in their subclass implementations to either call super or not call super. the ToDo list in this regard is at the bottom of the file.
> 
> attached is the new checker (CheckViewController.cpp), the diff to the changed files Checkers.td and CMakeLists.txt and a new test case.
> 
> please comment (and CC me) or commit.
> 
> UPDATE: i've modified the patch according to feedback on the IRC channel
> • better adherance to the llvm coding standards (tabs, linewidth, indentation)
> • don't use std::vector for static method selector name list
> • added test case to verify functionality
> • provide correct method name in diagnostic output
> • provide correct source location in diagnostic output
> • removed check for rare multi-arg selector transistionViewController* because checking multi-arg selectors doesn't seem to work (yet)
> 
> UPDATE2: because there has been no feedback or commit for 10+ days, i'm resending and also CCing relvant people, as i was instructed to do on the IRC channel.
> 
> 
> bye, julian
> 
> p.s. you could also (re)view the patch here on phabricator: http://llvm-reviews.chandlerc.com/D68
> 
> 
> <patch.diff><viewcontroller.m><CheckViewController.cpp>





More information about the cfe-commits mailing list