summaryrefslogtreecommitdiffstats
path: root/clang/Sema/Sema.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-10-17 16:58:11 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-10-17 16:58:11 +0000
commita32aaefadcf84f20861332961a5d2c68b19e3abb (patch)
treee281b6ab54b4d53ff2f42ae841f0e660c17ef1b6 /clang/Sema/Sema.cpp
parent7078da8e587d201765f293ed0ef0b63b2ad15deb (diff)
downloadbcm5719-llvm-a32aaefadcf84f20861332961a5d2c68b19e3abb.tar.gz
bcm5719-llvm-a32aaefadcf84f20861332961a5d2c68b19e3abb.zip
Implementation of AST for @protocol expression.
llvm-svn: 43075
Diffstat (limited to 'clang/Sema/Sema.cpp')
-rw-r--r--clang/Sema/Sema.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/Sema/Sema.cpp b/clang/Sema/Sema.cpp
index dc68eb03d85..5bd5df5539e 100644
--- a/clang/Sema/Sema.cpp
+++ b/clang/Sema/Sema.cpp
@@ -63,6 +63,24 @@ QualType Sema::GetObjcSelType(SourceLocation Loc) {
return Context.getObjcSelType();
}
+/// GetObjcProtoType - See comments for Sema::GetObjcIdType above; replace "id"
+/// with "Protocol".
+QualType Sema::GetObjcProtoType(SourceLocation Loc) {
+ assert(TUScope && "GetObjcProtoType(): Top-level scope is null");
+ if (Context.getObjcProtoType().isNull()) {
+ IdentifierInfo *ProtoIdent = &Context.Idents.get("Protocol");
+ ScopedDecl *ProtoDecl = LookupScopedDecl(ProtoIdent, Decl::IDNS_Ordinary,
+ SourceLocation(), TUScope);
+ TypedefDecl *ObjcProtoTypedef = dyn_cast_or_null<TypedefDecl>(ProtoDecl);
+ if (!ObjcProtoTypedef) {
+ Diag(Loc, diag::err_missing_proto_definition);
+ return QualType();
+ }
+ Context.setObjcProtoType(ObjcProtoTypedef);
+ }
+ return Context.getObjcProtoType();
+}
+
Sema::Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup)
: PP(pp), Context(ctxt), CurFunctionDecl(0), LastInGroupList(prevInGroup) {
OpenPOWER on IntegriCloud