diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-26 04:07:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-26 04:07:02 +0000 |
commit | 6bd6d0b9d8944c5e192097bef24f2becb83af172 (patch) | |
tree | 0030f21c52bca4980db2b0f478c5ab219a472529 /lib/Sema | |
parent | e13b9595dc1e2f4288bec34f3412359f648e84a5 (diff) |
refactor protocol resolution out of ActOnStartCategoryInterface
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/Sema.h | 15 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 21 |
2 files changed, 11 insertions, 25 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 7772006510..9584dcc468 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -624,13 +624,14 @@ public: DeclTy * const *ProtoRefNames, unsigned NumProtoRefs, SourceLocation EndProtoLoc); - virtual DeclTy *ActOnStartCategoryInterface( - SourceLocation AtInterfaceLoc, - IdentifierInfo *ClassName, SourceLocation ClassLoc, - IdentifierInfo *CategoryName, SourceLocation CategoryLoc, - const IdentifierLocPair *ProtoRefNames, - unsigned NumProtoRefs, - SourceLocation EndProtoLoc); + virtual DeclTy *ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, + IdentifierInfo *ClassName, + SourceLocation ClassLoc, + IdentifierInfo *CategoryName, + SourceLocation CategoryLoc, + DeclTy * const *ProtoRefs, + unsigned NumProtoRefs, + SourceLocation EndProtoLoc); virtual DeclTy *ActOnStartClassImplementation( SourceLocation AtClassImplLoc, diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 5bafa236fb..570437d071 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -402,7 +402,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, - const IdentifierLocPair *ProtoRefNames, + DeclTy * const *ProtoRefs, unsigned NumProtoRefs, SourceLocation EndProtoLoc) { ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); @@ -430,24 +430,9 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, } if (NumProtoRefs) { - llvm::SmallVector<ObjCProtocolDecl*, 32> RefProtocols; - /// Check and then save the referenced protocols. - for (unsigned int i = 0; i != NumProtoRefs; i++) { - ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtoRefNames[i].first]; - if (!RefPDecl) - Diag(ProtoRefNames[i].second, diag::err_undeclared_protocol, - ProtoRefNames[i].first->getName()); - else { - if (RefPDecl->isForwardDecl()) - Diag(ProtoRefNames[i].second, diag::warn_undef_protocolref, - ProtoRefNames[i].first->getName()); - RefProtocols.push_back(RefPDecl); - } - } - if (!RefProtocols.empty()) - CDecl->addReferencedProtocols(&RefProtocols[0], RefProtocols.size()); + CDecl->addReferencedProtocols((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs); + CDecl->setLocEnd(EndProtoLoc); } - CDecl->setLocEnd(EndProtoLoc); return CDecl; } |