r216282 - Objective-C. Update my previous patch to not warn if
Fariborz Jahanian
fjahanian at apple.com
Fri Aug 22 12:52:49 PDT 2014
Author: fjahanian
Date: Fri Aug 22 14:52:49 2014
New Revision: 216282
URL: http://llvm.org/viewvc/llvm-project?rev=216282&view=rev
Log:
Objective-C. Update my previous patch to not warn if
+initialize is called on 'super' in its implementation.
rdar://16628028
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/warn-explicit-call-initialize.m
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=216282&r1=216281&r2=216282&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Aug 22 14:52:49 2014
@@ -2232,8 +2232,9 @@ ExprResult Sema::BuildClassMessage(TypeS
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) {
Modified: cfe/trunk/test/SemaObjC/warn-explicit-call-initialize.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-explicit-call-initialize.m?rev=216282&r1=216281&r2=216282&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/warn-explicit-call-initialize.m (original)
+++ cfe/trunk/test/SemaObjC/warn-explicit-call-initialize.m Fri Aug 22 14:52:49 2014
@@ -14,6 +14,8 @@
[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
More information about the cfe-commits
mailing list