+initialize is called on 'super' in its implementation.
rdar://
16628028
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216282
91177308-0d34-0410-b5e6-
96231b3b80d8
diag::err_illegal_message_expr_incomplete_type))
return ExprError();
- // Warn about explicit call of +initialize on its own class.
- if (Method && Method->getMethodFamily() == OMF_initialize) {
+ // Warn about explicit call of +initialize on its own class. But not on 'super'.
+ if (Method && Method->getMethodFamily() == OMF_initialize &&
+ !SuperLoc.isValid()) {
const ObjCInterfaceDecl *ID =
dyn_cast<ObjCInterfaceDecl>(Method->getDeclContext());
if (ID == Class) {
[I initialize]; // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}}
[NSObject initialize]; // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}}
}
-+ (void)initialize {}
++ (void)initialize {
+ [super initialize];
+}
@end