diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-05 21:01:53 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-05 21:01:53 +0000 |
| commit | ea7a98d8d65b469c6bcef302eb675b4fcdbff38c (patch) | |
| tree | 786a47fc40d54dd267985fb43de5500418d757e5 /clang/Sema/SemaDecl.cpp | |
| parent | 64a9ca7c58606236425788aa5628bf24511be4f6 (diff) | |
| download | bcm5719-llvm-ea7a98d8d65b469c6bcef302eb675b4fcdbff38c.tar.gz bcm5719-llvm-ea7a98d8d65b469c6bcef302eb675b4fcdbff38c.zip | |
This is the first patch toward supporting protocol conforming
objective-c types. It also removes use of Scope* parameter in
getObjCProtocolDecl.
llvm-svn: 42649
Diffstat (limited to 'clang/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/Sema/SemaDecl.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp index b827732b872..8f743789e84 100644 --- a/clang/Sema/SemaDecl.cpp +++ b/clang/Sema/SemaDecl.cpp @@ -104,8 +104,14 @@ ObjcProtocolDecl *Sema::getObjCProtocolDecl(Scope *S, IdentifierInfo *Id, SourceLocation IdLoc) { // Note that Protocols have their own namespace. - ScopedDecl *PrDecl = LookupScopedDecl(Id, Decl::IDNS_Protocol, - IdLoc, S); + ScopedDecl *PrDecl = NULL; + for (ScopedDecl *D = Id->getFETokenInfo<ScopedDecl>(); D; D = D->getNext()) { + if (D->getIdentifierNamespace() == Decl::IDNS_Protocol) { + PrDecl = D; + break; + } + } + if (PrDecl && !isa<ObjcProtocolDecl>(PrDecl)) PrDecl = 0; return cast_or_null<ObjcProtocolDecl>(static_cast<Decl*>(PrDecl)); @@ -1007,6 +1013,24 @@ Sema::DeclTy *Sema::ActOnStartProtocolInterface(Scope* S, return PDecl; } +/// ActOnFindProtocolDeclaration - This routine looks for a previously +/// declared protocol and returns it. If not found, issues diagnostic. +/// Will build a list of previously protocol declarations found in the list. +Action::DeclTy ** +Sema::ActOnFindProtocolDeclaration(Scope *S, + SourceLocation TypeLoc, + IdentifierInfo **ProtocolId, + unsigned NumProtocols) { + for (unsigned i = 0; i != NumProtocols; ++i) { + ObjcProtocolDecl *PDecl = getObjCProtocolDecl(S, ProtocolId[i], + TypeLoc); + if (!PDecl) + Diag(TypeLoc, diag::err_undeclared_protocol, + ProtocolId[i]->getName()); + } + return 0; +} + /// ActOnForwardProtocolDeclaration - /// Scope will always be top level file scope. Action::DeclTy * |

