diff options
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) { |