Added a test case for __weak field decls. Change SetVarDeclObjCAttribute
to static function. Added comments.

llvm-svn: 59738
diff --git a/clang/test/SemaObjC/warn-weak-field.m b/clang/test/SemaObjC/warn-weak-field.m
new file mode 100644
index 0000000..93c23be
--- /dev/null
+++ b/clang/test/SemaObjC/warn-weak-field.m
@@ -0,0 +1,13 @@
+// RUN: clang -fsyntax-only -fobjc-gc -verify %s
+
+struct S {
+	__weak id w; // expected-warning {{__weak attribute cannot be specified on a field declaration}}
+	__strong id p1;
+};
+
+int main ()
+{
+	struct I {
+        __weak id w1;  // expected-warning {{__weak attribute cannot be specified on a field declaration}}
+	};
+}