forked from OSchip/llvm-project
revert r231700 (designated initializer patch) which broke
several projects. rdar://20120666. llvm-svn: 231939
This commit is contained in:
parent
4fa0305b72
commit
20cfff3d31
|
@ -803,8 +803,6 @@ public:
|
||||||
return hasDesignatedInitializers() || inheritsDesignatedInitializers();
|
return hasDesignatedInitializers() || inheritsDesignatedInitializers();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasDesignatedInitializersInSuperClass() const;
|
|
||||||
|
|
||||||
const ObjCProtocolList &getReferencedProtocols() const {
|
const ObjCProtocolList &getReferencedProtocols() const {
|
||||||
assert(hasDefinition() && "Caller did not check for forward reference!");
|
assert(hasDefinition() && "Caller did not check for forward reference!");
|
||||||
if (data().ExternallyCompleted)
|
if (data().ExternallyCompleted)
|
||||||
|
|
|
@ -2926,7 +2926,8 @@ public:
|
||||||
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D);
|
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D);
|
||||||
|
|
||||||
void DiagnoseMissingDesignatedInitOverrides(
|
void DiagnoseMissingDesignatedInitOverrides(
|
||||||
const ObjCImplementationDecl *ImplD);
|
const ObjCImplementationDecl *ImplD,
|
||||||
|
const ObjCInterfaceDecl *IFD);
|
||||||
|
|
||||||
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID);
|
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID);
|
||||||
|
|
||||||
|
|
|
@ -1213,16 +1213,6 @@ bool ObjCInterfaceDecl::hasDesignatedInitializers() const {
|
||||||
return data().HasDesignatedInitializers;
|
return data().HasDesignatedInitializers;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjCInterfaceDecl::hasDesignatedInitializersInSuperClass() const {
|
|
||||||
ObjCInterfaceDecl *OSC = getSuperClass();
|
|
||||||
while (OSC) {
|
|
||||||
if (OSC->hasDesignatedInitializers())
|
|
||||||
return true;
|
|
||||||
OSC = OSC->getSuperClass();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringRef
|
StringRef
|
||||||
ObjCInterfaceDecl::getObjCRuntimeNameAsString() const {
|
ObjCInterfaceDecl::getObjCRuntimeNameAsString() const {
|
||||||
if (ObjCRuntimeNameAttr *ObjCRTName = getAttr<ObjCRuntimeNameAttr>())
|
if (ObjCRuntimeNameAttr *ObjCRTName = getAttr<ObjCRuntimeNameAttr>())
|
||||||
|
|
|
@ -2715,9 +2715,8 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
|
||||||
AtomicPropertySetterGetterRules(IC, IDecl);
|
AtomicPropertySetterGetterRules(IC, IDecl);
|
||||||
DiagnoseOwningPropertyGetterSynthesis(IC);
|
DiagnoseOwningPropertyGetterSynthesis(IC);
|
||||||
DiagnoseUnusedBackingIvarInAccessor(S, IC);
|
DiagnoseUnusedBackingIvarInAccessor(S, IC);
|
||||||
if (IDecl->hasDesignatedInitializers() ||
|
if (IDecl->hasDesignatedInitializers())
|
||||||
IDecl->hasDesignatedInitializersInSuperClass())
|
DiagnoseMissingDesignatedInitOverrides(IC, IDecl);
|
||||||
DiagnoseMissingDesignatedInitOverrides(IC);
|
|
||||||
|
|
||||||
bool HasRootClassAttr = IDecl->hasAttr<ObjCRootClassAttr>();
|
bool HasRootClassAttr = IDecl->hasAttr<ObjCRootClassAttr>();
|
||||||
if (IDecl->getSuperClass() == nullptr) {
|
if (IDecl->getSuperClass() == nullptr) {
|
||||||
|
|
|
@ -1894,11 +1894,9 @@ void Sema::DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::DiagnoseMissingDesignatedInitOverrides(
|
void Sema::DiagnoseMissingDesignatedInitOverrides(
|
||||||
const ObjCImplementationDecl *ImplD) {
|
const ObjCImplementationDecl *ImplD,
|
||||||
const ObjCInterfaceDecl *IFD = ImplD->getClassInterface();
|
const ObjCInterfaceDecl *IFD) {
|
||||||
assert(IFD);
|
assert(IFD->hasDesignatedInitializers());
|
||||||
assert(IFD->hasDesignatedInitializers() ||
|
|
||||||
IFD->hasDesignatedInitializersInSuperClass());
|
|
||||||
const ObjCInterfaceDecl *SuperD = IFD->getSuperClass();
|
const ObjCInterfaceDecl *SuperD = IFD->getSuperClass();
|
||||||
if (!SuperD)
|
if (!SuperD)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -39,7 +39,7 @@ __attribute__((objc_root_class))
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface B1()
|
@interface B1()
|
||||||
-(id)initB3 NS_DESIGNATED_INITIALIZER; // expected-note 6 {{method marked as designated initializer of the class here}}
|
-(id)initB3 NS_DESIGNATED_INITIALIZER; // expected-note 4 {{method marked as designated initializer of the class here}}
|
||||||
@end;
|
@end;
|
||||||
|
|
||||||
@implementation B1
|
@implementation B1
|
||||||
|
@ -182,7 +182,7 @@ __attribute__((objc_root_class))
|
||||||
-(id)initB1;
|
-(id)initB1;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SS4 // expected-warning {{method override for the designated initializer of the superclass '-initB3' not found}}
|
@implementation SS4
|
||||||
-(id)initB1 { // expected-warning {{designated initializer missing a 'super' call to a designated initializer of the super class}}
|
-(id)initB1 { // expected-warning {{designated initializer missing a 'super' call to a designated initializer of the super class}}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ __attribute__((objc_root_class))
|
||||||
-(id)initB1;
|
-(id)initB1;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SS9 // expected-warning {{method override for the designated initializer of the superclass '-initB3' not found}}
|
@implementation SS9
|
||||||
-(id)initB1 { // expected-warning {{designated initializer missing a 'super' call to a designated initializer of the super class}}
|
-(id)initB1 { // expected-warning {{designated initializer missing a 'super' call to a designated initializer of the super class}}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -418,41 +418,3 @@ __attribute__((objc_root_class))
|
||||||
@interface CategoryForMissingInterface(Cat) // expected-error{{cannot find interface declaration}}
|
@interface CategoryForMissingInterface(Cat) // expected-error{{cannot find interface declaration}}
|
||||||
- (instancetype)init NS_DESIGNATED_INITIALIZER; // expected-error{{only applies to init methods of interface or class extension declarations}}
|
- (instancetype)init NS_DESIGNATED_INITIALIZER; // expected-error{{only applies to init methods of interface or class extension declarations}}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// rdar://19653785
|
|
||||||
@class NSCoder;
|
|
||||||
|
|
||||||
@interface NSView
|
|
||||||
- (instancetype)initWithFrame:(int)frameRect NS_DESIGNATED_INITIALIZER; // expected-note {{method marked as designated initializer of the class here}}
|
|
||||||
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; // expected-note 2 {{method marked as designated initializer of the class here}}
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface MyHappyView : NSView
|
|
||||||
- (instancetype)initWithFrame:(int)frameRect andOtherThing:(id)otherThing NS_DESIGNATED_INITIALIZER;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MyHappyView // expected-warning {{method override for the designated initializer of the superclass '-initWithCoder:' not found}}
|
|
||||||
- (instancetype)initWithFrame:(int)frameRect andOtherThing:(id)otherThing {
|
|
||||||
if (self = [super initWithFrame:frameRect]) {
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(int)frameRect {
|
|
||||||
return [self initWithFrame:frameRect andOtherThing:((void *)0)];
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface MySadView : NSView
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MySadView // expected-warning {{method override for the designated initializer of the superclass '-initWithFrame:' not found}} \
|
|
||||||
// expected-warning {{method override for the designated initializer of the superclass '-initWithCoder:' not found}}
|
|
||||||
- (instancetype)initWithFrame:(int)frameRect andOtherThing:(id)otherThing {
|
|
||||||
if (self = [super initWithFrame:frameRect]) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue