Issue error if variables are defined inside an objc class,
category or protocol.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67450 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 9314134..ba35333 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1339,14 +1339,16 @@
       }
     }
   }
-  llvm::SmallVector<VarDecl*, 8> allTUVariables;
-  for (unsigned i = 0; i < tuvNum; i++) {
-    if (VarDecl *VD = dyn_cast<VarDecl>((Decl*)allTUVars[i]))
-      allTUVariables.push_back(VD);
-  }
-  if (!allTUVariables.empty() && isInterfaceDeclKind) {
-    ObjCContainerDecl *OCD = dyn_cast<ObjCContainerDecl>(ClassDecl);
-    OCD->setTUVarList(&allTUVariables[0], allTUVariables.size(), Context);
+  if (isInterfaceDeclKind)
+    for (unsigned i = 0; i < tuvNum; i++) {
+      if (VarDecl *VDecl = dyn_cast<VarDecl>((Decl*)allTUVars[i])) {
+        if (VDecl->getStorageClass() != VarDecl::Extern &&
+            VDecl->getStorageClass() != VarDecl::PrivateExtern) {
+          NamedDecl  *ClassNameDecl = dyn_cast<NamedDecl>(ClassDecl);
+          Diag(VDecl->getLocation(), diag::err_objc_var_decl_inclass) 
+            << ClassNameDecl->getIdentifier();
+        }
+     }
   }
 }