objc: Implemented variables declared in class interface
whose sema decl is at the translation unit.
llvm-svn: 67249
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 0cb9228..aed0676 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1234,16 +1234,24 @@
// 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<ObjCProtocolDecl>(D));
+ 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));
break;
+ }
case Decl::ObjCCategoryImpl:
// Categories have properties but don't support synthesize so we