mirror of https://github.com/microsoft/clang.git
Fix an assertion hit in Sema::CheckObjCMethodOverrides.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180651 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
91efca0fa2
commit
ab3d509bc4
|
@ -2077,8 +2077,9 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left,
|
||||||
void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) {
|
void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) {
|
||||||
// Record at the head of the list whether there were 0, 1, or >= 2 methods
|
// Record at the head of the list whether there were 0, 1, or >= 2 methods
|
||||||
// inside categories.
|
// inside categories.
|
||||||
if (isa<ObjCCategoryDecl>(Method->getDeclContext()))
|
if (ObjCCategoryDecl *
|
||||||
if (List->getBits() < 2)
|
CD = dyn_cast<ObjCCategoryDecl>(Method->getDeclContext()))
|
||||||
|
if (!CD->IsClassExtension() && List->getBits() < 2)
|
||||||
List->setBits(List->getBits()+1);
|
List->setBits(List->getBits()+1);
|
||||||
|
|
||||||
// If the list is empty, make it a singleton list.
|
// If the list is empty, make it a singleton list.
|
||||||
|
@ -2828,7 +2829,8 @@ void Sema::CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
|
||||||
for (OverrideSearch::iterator
|
for (OverrideSearch::iterator
|
||||||
OI= overrides.begin(), OE= overrides.end(); OI!=OE; ++OI) {
|
OI= overrides.begin(), OE= overrides.end(); OI!=OE; ++OI) {
|
||||||
ObjCMethodDecl *SuperOverridden = *OI;
|
ObjCMethodDecl *SuperOverridden = *OI;
|
||||||
if (CurrentClass != SuperOverridden->getClassInterface()) {
|
if (isa<ObjCProtocolDecl>(SuperOverridden->getDeclContext()) ||
|
||||||
|
CurrentClass != SuperOverridden->getClassInterface()) {
|
||||||
hasOverriddenMethodsInBaseOrProtocol = true;
|
hasOverriddenMethodsInBaseOrProtocol = true;
|
||||||
overridden->setOverriding(true);
|
overridden->setOverriding(true);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -32,3 +32,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@protocol ProtC
|
||||||
|
-document;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface I1 : NSObject
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface I1(cat)
|
||||||
|
-document;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface I2 : NSObject
|
||||||
|
-document;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface I2() <ProtC>
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation I2
|
||||||
|
- document { return 0; }
|
||||||
|
@end
|
||||||
|
|
Loading…
Reference in New Issue