Index: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -715,6 +715,10 @@ bool ObjCDeallocChecker::diagnoseMistakenDealloc(SymbolRef DeallocedValue, const ObjCMethodCall &M, CheckerContext &C) const { + // TODO: Apart from unknown/undefined receivers, this may happen when + // dealloc is called as a class method. Should we warn? + if (!DeallocedValue) + return false; // Find the property backing the instance variable that M // is dealloc'ing. Index: cfe/trunk/test/Analysis/MissingDealloc.m =================================================================== --- cfe/trunk/test/Analysis/MissingDealloc.m +++ cfe/trunk/test/Analysis/MissingDealloc.m @@ -183,4 +183,17 @@ @implementation NonNSObjectMissingDealloc @end -// CHECK: 4 warnings generated. + +//===------------------------------------------------------------------------=== +// Don't crash on calls to dealloc as a class method. + +@interface DeallocingClass : NSObject {} +@end +@implementation DeallocingClass +- (void)dealloc { + [DeallocingClass dealloc]; // FIXME: Should we warn on this specifically? +} +#if NON_ARC +// expected-warning@-2{{method possibly missing a [super dealloc] call}} +#endif +@end