diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-23 23:18:26 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-23 23:18:26 +0000 |
commit | 6e378de1aebdfeb44f2a7677ed207b32b3a41fbf (patch) | |
tree | ebe6d9f2667badf85db5bc196865c133be715138 /lib/Sema/SemaDeclObjC.cpp | |
parent | 99612939d02d99a6ef3ff037aa14c4277e9c43ce (diff) |
Eliminate Sema::ObjCProtocols. Instead, we place ObjCProtocolDecls in
their own namespace (IDNS_Protocol) and use the normal name-lookup
routines to find them. Aside from the simplification this provides
(one less DenseMap!), it means that protocols will be lazily
deserialized from PCH files.
Make the code size of the selector table block match the code size of
the type and decl blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 6702eb9a7a..7badaa3130 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -222,7 +222,7 @@ void Sema::CheckForwardProtocolDeclarationForCircularDependency( for (ObjCList<ObjCProtocolDecl>::iterator I = PList.begin(), E = PList.end(); I != E; ++I) { - if (ObjCProtocolDecl *PDecl = ObjCProtocols[(*I)->getIdentifier()]) { + if (ObjCProtocolDecl *PDecl = LookupProtocol((*I)->getIdentifier())) { if (PDecl->getIdentifier() == PName) { Diag(Ploc, diag::err_protocol_has_circular_dependency); Diag(PrevLoc, diag::note_previous_definition); @@ -243,7 +243,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, AttributeList *AttrList) { // FIXME: Deal with AttrList. assert(ProtocolName && "Missing protocol identifier"); - ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolName]; + ObjCProtocolDecl *PDecl = LookupProtocol(ProtocolName); if (PDecl) { // Protocol already seen. Better be a forward protocol declaration if (!PDecl->isForwardDecl()) { @@ -265,10 +265,8 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, } else { PDecl = ObjCProtocolDecl::Create(Context, CurContext, AtProtoInterfaceLoc,ProtocolName); - // FIXME: PushOnScopeChains? - CurContext->addDecl(Context, PDecl); + PushOnScopeChains(PDecl, TUScope); PDecl->setForwardDecl(false); - ObjCProtocols[ProtocolName] = PDecl; } if (AttrList) ProcessDeclAttributeList(PDecl, AttrList); @@ -291,7 +289,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations, unsigned NumProtocols, llvm::SmallVectorImpl<DeclPtrTy> &Protocols) { for (unsigned i = 0; i != NumProtocols; ++i) { - ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolId[i].first]; + ObjCProtocolDecl *PDecl = LookupProtocol(ProtocolId[i].first); if (!PDecl) { Diag(ProtocolId[i].second, diag::err_undeclared_protocol) << ProtocolId[i].first; @@ -514,12 +512,11 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, for (unsigned i = 0; i != NumElts; ++i) { IdentifierInfo *Ident = IdentList[i].first; - ObjCProtocolDecl *&PDecl = ObjCProtocols[Ident]; + ObjCProtocolDecl *PDecl = LookupProtocol(Ident); if (PDecl == 0) { // Not already seen? PDecl = ObjCProtocolDecl::Create(Context, CurContext, IdentList[i].second, Ident); - // FIXME: PushOnScopeChains? - CurContext->addDecl(Context, PDecl); + PushOnScopeChains(PDecl, TUScope); } if (attrList) ProcessDeclAttributeList(PDecl, attrList); |