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/SemaLookup.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/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 0b11d9cf68..613c30bc0c 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -293,6 +293,10 @@ getIdentifierNamespacesFromLookupNameKind(Sema::LookupNameKind NameKind, case Sema::LookupNamespaceName: IDNS = Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Member; break; + + case Sema::LookupProtocolName: + IDNS = Decl::IDNS_Protocol; + break; } return IDNS; } @@ -831,6 +835,10 @@ Sema::LookupName(Scope *S, DeclarationName Name, LookupNameKind NameKind, S = S->getParent(); IDNS = Decl::IDNS_Ordinary; break; + + case Sema::LookupProtocolName: + IDNS = Decl::IDNS_Protocol; + break; } // Scan up the scope chain looking for a decl that matches this @@ -1480,6 +1488,12 @@ IsAcceptableNonMemberOperatorCandidate(FunctionDecl *Fn, return false; } +/// \brief Find the protocol with the given name, if any. +ObjCProtocolDecl *Sema::LookupProtocol(IdentifierInfo *II) { + Decl *D = LookupName(TUScope, II, LookupProtocolName).getAsDecl(); + return cast_or_null<ObjCProtocolDecl>(D); +} + void Sema::LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, QualType T1, QualType T2, FunctionSet &Functions) { |