diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index e978a5b60fa..7f38ac1d9ad 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -148,15 +148,13 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList( } if (ProtocolRefs.empty()) return; - + // Merge ProtocolRefs into class's protocol list; for (protocol_iterator p = protocol_begin(), e = protocol_end(); p != e; p++) ProtocolRefs.push_back(*p); ReferencedProtocols.Destroy(C); unsigned NumProtoRefs = ProtocolRefs.size(); setProtocolList((ObjCProtocolDecl**)&ProtocolRefs[0], NumProtoRefs, C); - // Merge ProtocolRefs into class's protocol list; - } ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID, diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 51651ab4bba..8a69a861c40 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -588,15 +588,13 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, CDecl->insertNextClassCategory(); if (NumProtoRefs) { + CDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs, + Context); + CDecl->setLocEnd(EndProtoLoc); // Protocols in the class extension belong to the class. if (!CDecl->getIdentifier()) IDecl->mergeClassExtensionProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs,Context); - else { - CDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs, - Context); - CDecl->setLocEnd(EndProtoLoc); - } } CheckObjCDeclScope(CDecl); @@ -1102,10 +1100,14 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, } } } else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl)) { - for (ObjCCategoryDecl::protocol_iterator PI = C->protocol_begin(), - E = C->protocol_end(); PI != E; ++PI) - CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl, - InsMap, ClsMap, C->getClassInterface()); + // For extended class, unimplemented methods in its protocols will + // be reported in the primary class. + if (C->getIdentifier()) { + for (ObjCCategoryDecl::protocol_iterator PI = C->protocol_begin(), + E = C->protocol_end(); PI != E; ++PI) + CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl, + InsMap, ClsMap, C->getClassInterface()); + } } else assert(false && "invalid ObjCContainerDecl type."); } |