Warn on use of __weak attribute on local
variable (objc2 gc specific).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65240 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 51c4790..3130f02 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1592,6 +1592,11 @@
     Diag(D.getIdentifierLoc(), diag::err_as_qualified_auto_decl);
     InvalidDecl = true;
   }
+
+  if (NewVD->hasLocalStorage() && NewVD->getType().isObjCGCWeak()) {
+    Diag(D.getIdentifierLoc(), diag::warn_attribute_weak_on_local);
+  }
+
   // Merge the decl with the existing one if appropriate. If the decl is
   // in an outer scope, it isn't the same thing.
   if (PrevDecl && isDeclInScope(PrevDecl, DC, S)) {