- Make sure default return/argument types (for methods) default to "id".
- Cache the "id" type in Sema...initialize ObjcIdType and TUScope (oops).
- Fix ActOnInstanceMessage to allow for "id" type receivers...still work to do (next).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42842 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 4fc6f78..eb1b158 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1774,23 +1774,23 @@
 
   for (unsigned i = 0; i < Sel.getNumArgs(); i++) {
     // FIXME: arg->AttrList must be stored too!
+    QualType argType;
+    
+    if (ArgTypes[i])
+      argType = QualType::getFromOpaquePtr(ArgTypes[i]);
+    else
+      argType = GetObjcIdType();
     ParmVarDecl* Param = new ParmVarDecl(SourceLocation(/*FIXME*/), ArgNames[i], 
-                              QualType::getFromOpaquePtr(ArgTypes[i]), 
-                              VarDecl::None, 0);
+                                         argType, VarDecl::None, 0);
     Params.push_back(Param);
   }
   QualType resultDeclType;
   
   if (ReturnType)
     resultDeclType = QualType::getFromOpaquePtr(ReturnType);
-  else { // get the type for "id".
-    IdentifierInfo *IdIdent = &Context.Idents.get("id");
-    ScopedDecl *IdDecl = LookupScopedDecl(IdIdent, Decl::IDNS_Ordinary, 
-                                          SourceLocation(), TUScope);
-    TypedefDecl *IdTypedef = dyn_cast_or_null<TypedefDecl>(IdDecl);
-    assert(IdTypedef && "ActOnMethodDeclaration(): Couldn't find 'id' type");
-    resultDeclType = IdTypedef->getUnderlyingType();
-  }
+  else // get the type for "id".
+    resultDeclType = GetObjcIdType();
+
   ObjcMethodDecl* ObjcMethod =  new ObjcMethodDecl(MethodLoc, Sel,
                                       resultDeclType, 0, -1, AttrList, 
                                       MethodType == tok::minus,