objective-c: Provide a 'fixit' when class was used
to declare a static object. // rdar://9603056

llvm-svn: 135970
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8b02390..d231d3c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3937,7 +3937,8 @@
   QualType T = NewVD->getType();
 
   if (T->isObjCObjectType()) {
-    Diag(NewVD->getLocation(), diag::err_statically_allocated_object);
+    Diag(NewVD->getLocation(), diag::err_statically_allocated_object)
+      << FixItHint::CreateInsertion(NewVD->getLocation(), "*");
     return NewVD->setInvalidDecl();
   }
 
diff --git a/clang/test/FixIt/fixit-static-object-decl.m b/clang/test/FixIt/fixit-static-object-decl.m
new file mode 100644
index 0000000..c9661e2
--- /dev/null
+++ b/clang/test/FixIt/fixit-static-object-decl.m
@@ -0,0 +1,18 @@
+// Objective-C recovery
+// RUN: cp %s %t
+// RUN: %clang_cc1 -fixit -x objective-c %t || true
+// RUN: %clang_cc1 -fsyntax-only -Werror -x objective-c %t
+
+// Objective-C++ recovery
+// RUN: cp %s %t
+// RUN: %clang_cc1 -fixit -x objective-c++ %t || true
+// RUN: %clang_cc1 -fsyntax-only -Werror -x objective-c++ %t
+// rdar://9603056
+
+@interface NSArray
++ (id) arrayWithObjects;
+@end
+
+int main() {
+  	NSArray pluginNames = [NSArray arrayWithObjects];
+}