Patch to implement AST generation for objective-c's @selector expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43038 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.cpp b/Sema/Sema.cpp
index 330d9dc..dc68eb0 100644
--- a/Sema/Sema.cpp
+++ b/Sema/Sema.cpp
@@ -45,6 +45,23 @@
   return Context.getObjcIdType();
 }
 
+/// GetObjcSelType - See comments for Sema::GetObjcIdType above; replace "id"
+/// with "SEL".
+QualType Sema::GetObjcSelType(SourceLocation Loc) {
+  assert(TUScope && "GetObjcSelType(): Top-level scope is null");
+  if (Context.getObjcSelType().isNull()) {
+    IdentifierInfo *SelIdent = &Context.Idents.get("SEL");
+    ScopedDecl *SelDecl = LookupScopedDecl(SelIdent, Decl::IDNS_Ordinary, 
+                                          SourceLocation(), TUScope);
+    TypedefDecl *ObjcSelTypedef = dyn_cast_or_null<TypedefDecl>(SelDecl);
+    if (!ObjcSelTypedef) {
+      Diag(Loc, diag::err_missing_sel_definition);
+      return QualType();
+    }
+    Context.setObjcSelType(ObjcSelTypedef);
+  }
+  return Context.getObjcSelType();
+}
 
 Sema::Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup)
   : PP(pp), Context(ctxt), CurFunctionDecl(0), LastInGroupList(prevInGroup) {