diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-03-21 18:06:45 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-03-21 18:06:45 +0000 |
commit | b31cb7f1752ea011fd06ac9574ce24667d11cbdb (patch) | |
tree | 464b764f2785774079b1c05392bb5dca1590e20b /lib/Sema/SemaDeclObjC.cpp | |
parent | 5674388eb637999f9de3f6398ddfc6bcfaac75b8 (diff) |
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
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 9314134161..ba35333fe5 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1339,14 +1339,16 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, } } } - 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(); + } + } } } |