Fix <rdar://problem/6500554> missing objc error message.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65198 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index c7f37fc..dfa1e03 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1470,8 +1470,7 @@
     CheckExtraCXXDefaultArguments(D);
 
   if (R.getTypePtr()->isObjCInterfaceType()) {
-    Diag(D.getIdentifierLoc(), diag::err_statically_allocated_object)
-      << D.getIdentifier();
+    Diag(D.getIdentifierLoc(), diag::err_statically_allocated_object);
     InvalidDecl = true;
   }
 
@@ -2761,6 +2760,13 @@
       << D.getCXXScopeSpec().getRange();
     New->setInvalidDecl();
   }
+  // Parameter declarators cannot be interface types. All ObjC objects are
+  // passed by reference.
+  if (parmDeclType->isObjCInterfaceType()) {
+    Diag(D.getIdentifierLoc(), diag::err_object_cannot_be_by_value) 
+         << "passed";
+    New->setInvalidDecl();
+  }
 
   // Add the parameter declaration into this scope.
   S->AddDecl(New);
@@ -3671,8 +3677,7 @@
     }
     /// A field cannot be an Objective-c object
     if (FDTy->isObjCInterfaceType()) {
-      Diag(FD->getLocation(), diag::err_statically_allocated_object)
-        << FD->getDeclName();
+      Diag(FD->getLocation(), diag::err_statically_allocated_object);
       FD->setInvalidDecl();
       EnclosingDecl->setInvalidDecl();
       continue;