From 38e24c782c17b6058bf61d635747bbde19fb1bc7 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 18 Mar 2009 22:33:24 +0000 Subject: objc: Implemented variables declared in class interface whose sema decl is at the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67249 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 0cb9228536..aed067617e 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1234,16 +1234,24 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { // Objective-C Decls - // Forward declarations, no (immediate) code generation. + // Forward declarations, no (immediate) code generation. case Decl::ObjCClass: - case Decl::ObjCCategory: case Decl::ObjCForwardProtocol: - case Decl::ObjCInterface: break; - + case Decl::ObjCProtocol: - Runtime->GenerateProtocol(cast(D)); + case Decl::ObjCCategory: + case Decl::ObjCInterface: { + ObjCContainerDecl *OCD = cast(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(D)); break; + } case Decl::ObjCCategoryImpl: // Categories have properties but don't support synthesize so we -- cgit v1.2.3-18-g5258