diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 18 |
2 files changed, 13 insertions, 19 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 93bf6dd8f00..b259a5dc2cf 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1270,21 +1270,13 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { // Forward declarations, no (immediate) code generation. case Decl::ObjCClass: case Decl::ObjCForwardProtocol: + case Decl::ObjCCategory: + case Decl::ObjCInterface: break; case Decl::ObjCProtocol: - case Decl::ObjCCategory: - case Decl::ObjCInterface: { - ObjCContainerDecl *OCD = cast<ObjCContainerDecl>(D); - for (ObjCContainerDecl::tuvar_iterator i = OCD->tuvar_begin(), - e = OCD->tuvar_end(); i != e; ++i) { - VarDecl *VD = *i; - EmitGlobal(VD); - } - if (D->getKind() == Decl::ObjCProtocol) - Runtime->GenerateProtocol(cast<ObjCProtocolDecl>(D)); + Runtime->GenerateProtocol(cast<ObjCProtocolDecl>(D)); break; - } case Decl::ObjCCategoryImpl: // Categories have properties but don't support synthesize so we 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(); + } + } } } |