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 | 629aed9327049b57d609cf8795bc2a54ce1afee8 (patch) | |
| tree | 7c499c99c24594de1984f81b8d4771aca5ddacde /clang/lib/Sema | |
| parent | 891d57155e148556b8777a081e36920929b508cf (diff) | |
| download | bcm5719-llvm-629aed9327049b57d609cf8795bc2a54ce1afee8.tar.gz bcm5719-llvm-629aed9327049b57d609cf8795bc2a54ce1afee8.zip | |
Issue error if variables are defined inside an objc class,
category or protocol.
llvm-svn: 67450
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 93141341615..ba35333fe52 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/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(); + } + } } } |

