Objective-C. Redo turning off designated initialization warnings on
'init' methods which are unavailable. Subclasses of NSObject have to implement such methods as a common pattern to prevent user's own implementation. // rdar://16305460 llvm-svn: 203984
This commit is contained in:
parent
2e4e62e2cc
commit
e3b5c99fde
|
@ -9831,14 +9831,19 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
|
|||
MD->isDesignatedInitializerForTheInterface(&InitMethod);
|
||||
assert(isDesignated && InitMethod);
|
||||
(void)isDesignated;
|
||||
Diag(MD->getLocation(),
|
||||
diag::warn_objc_designated_init_missing_super_call);
|
||||
Diag(InitMethod->getLocation(),
|
||||
diag::note_objc_designated_init_marked_here);
|
||||
// Don't issue this warning for unavaialable inits.
|
||||
if (!MD->isUnavailable()) {
|
||||
Diag(MD->getLocation(),
|
||||
diag::warn_objc_designated_init_missing_super_call);
|
||||
Diag(InitMethod->getLocation(),
|
||||
diag::note_objc_designated_init_marked_here);
|
||||
}
|
||||
getCurFunction()->ObjCWarnForNoDesignatedInitChain = false;
|
||||
}
|
||||
if (getCurFunction()->ObjCWarnForNoInitDelegation) {
|
||||
Diag(MD->getLocation(), diag::warn_objc_secondary_init_missing_init_call);
|
||||
// Don't issue this warning for unavaialable inits.
|
||||
if (!MD->isUnavailable())
|
||||
Diag(MD->getLocation(), diag::warn_objc_secondary_init_missing_init_call);
|
||||
getCurFunction()->ObjCWarnForNoInitDelegation = false;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -392,14 +392,11 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
|
|||
if (MDecl->getMethodFamily() == OMF_init) {
|
||||
if (MDecl->isDesignatedInitializerForTheInterface()) {
|
||||
getCurFunction()->ObjCIsDesignatedInit = true;
|
||||
// Don't issue this warning for unavaialable inits.
|
||||
if (!MDecl->isUnavailable())
|
||||
getCurFunction()->ObjCWarnForNoDesignatedInitChain =
|
||||
getCurFunction()->ObjCWarnForNoDesignatedInitChain =
|
||||
IC->getSuperClass() != 0;
|
||||
} else if (IC->hasDesignatedInitializers()) {
|
||||
getCurFunction()->ObjCIsSecondaryInit = true;
|
||||
// Don't issue this warning for unavaialable inits.
|
||||
getCurFunction()->ObjCWarnForNoInitDelegation = !MDecl->isUnavailable();
|
||||
getCurFunction()->ObjCWarnForNoInitDelegation = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue