r180651 - Fix an assertion hit in Sema::CheckObjCMethodOverrides.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Apr 26 17:10:13 PDT 2013
Author: akirtzidis
Date: Fri Apr 26 19:10:12 2013
New Revision: 180651
URL: http://llvm.org/viewvc/llvm-project?rev=180651&view=rev
Log:
Fix an assertion hit in Sema::CheckObjCMethodOverrides.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/protocol-lookup-2.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=180651&r1=180650&r2=180651&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Apr 26 19:10:12 2013
@@ -2077,9 +2077,10 @@ bool Sema::MatchTwoMethodDeclarations(co
void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) {
// Record at the head of the list whether there were 0, 1, or >= 2 methods
// inside categories.
- if (isa<ObjCCategoryDecl>(Method->getDeclContext()))
- if (List->getBits() < 2)
- List->setBits(List->getBits()+1);
+ if (ObjCCategoryDecl *
+ CD = dyn_cast<ObjCCategoryDecl>(Method->getDeclContext()))
+ if (!CD->IsClassExtension() && List->getBits() < 2)
+ List->setBits(List->getBits()+1);
// If the list is empty, make it a singleton list.
if (List->Method == 0) {
@@ -2828,7 +2829,8 @@ void Sema::CheckObjCMethodOverrides(ObjC
for (OverrideSearch::iterator
OI= overrides.begin(), OE= overrides.end(); OI!=OE; ++OI) {
ObjCMethodDecl *SuperOverridden = *OI;
- if (CurrentClass != SuperOverridden->getClassInterface()) {
+ if (isa<ObjCProtocolDecl>(SuperOverridden->getDeclContext()) ||
+ CurrentClass != SuperOverridden->getClassInterface()) {
hasOverriddenMethodsInBaseOrProtocol = true;
overridden->setOverriding(true);
break;
Modified: cfe/trunk/test/SemaObjC/protocol-lookup-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-lookup-2.m?rev=180651&r1=180650&r2=180651&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-lookup-2.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-lookup-2.m Fri Apr 26 19:10:12 2013
@@ -32,3 +32,26 @@
}
@end
+
+
+ at protocol ProtC
+-document;
+ at end
+
+ at interface I1 : NSObject
+ at end
+
+ at interface I1(cat)
+-document;
+ at end
+
+ at interface I2 : NSObject
+-document;
+ at end
+
+ at interface I2() <ProtC>
+ at end
+
+ at implementation I2
+- document { return 0; }
+ at end
More information about the cfe-commits
mailing list