summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-10-05 21:32:49 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-10-05 21:32:49 +0000
commit8764c74784766fc4b159431249c366b465dacf44 (patch)
tree291d4e46280815bf462f3c961c5cd8fe904938df /clang/lib
parent78a2e6356b61741203a6a8c027148298c62295d2 (diff)
downloadbcm5719-llvm-8764c74784766fc4b159431249c366b465dacf44.tar.gz
bcm5719-llvm-8764c74784766fc4b159431249c366b465dacf44.zip
tweaked my last patch to 1) preserve the protocol in
extension class's protocol list so its AST is complete. 2) Because of this no need to issue warning on unimplemeted methods coming from the extended class protocols because warning is issued when class definition is seen. llvm-svn: 83326
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/DeclObjC.cpp4
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp20
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.");
}
OpenPOWER on IntegriCloud