[cfe-dev] Self-init check should only run on NSObject subclasses

Argyrios Kyrtzidis kyrtzidis at apple.com
Tue Jan 25 15:47:20 PST 2011

On Jan 25, 2011, at 3:09 AM, Jean-Daniel Dupas wrote:

> Actually, the self-init check is performed on all classes. But NSProxy does not even implement -init. So, in proxy subclasses, it is not possible to call [super init].
> I attach a patch to disable this check on classes that does not inherit NSObject.

Looks good, apart from a nitpick:

-  if (!MD->getClassInterface()->getSuperClass())
+  // self = [super init] applies only to NSObject subclasses.
+  // For instance, NSProxy doesn't implement -init.
+  ASTContext& Ctx = C.getASTContext();

You can get the ASTContext using MD->getASTContext() and avoid passing "CheckerContext &C" around.


> -- Jean-Daniel
> <self-init.patch>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list