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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59738 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/warn-weak-field.m b/test/SemaObjC/warn-weak-field.m
new file mode 100644
index 0000000..93c23be
--- /dev/null
+++ b/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}}
+	};
+}