Patch to store ivars into interface class object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41961 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 05ec204..6e2f431 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -877,9 +877,9 @@
return IDecl;
}
-void Sema::ObjcAddInstanceVariable(DeclTy *ClassDecl, DeclTy **Ivar,
- unsigned numIvars,
- tok::ObjCKeywordKind *visibility) {
+void Sema::ObjcAddVisibilityToIvars(DeclTy *ClassDecl, DeclTy **Ivar,
+ unsigned numIvars,
+ tok::ObjCKeywordKind *visibility) {
assert((ClassDecl && numIvars) && "missing class or instance variable");
ObjcInterfaceDecl *OInterface = dyn_cast<ObjcInterfaceDecl>(
static_cast<Decl *>(ClassDecl));
@@ -1217,6 +1217,12 @@
// Okay, we successfully defined 'Record'.
if (Record)
Record->defineBody(&RecFields[0], RecFields.size());
+ else {
+ ObjcIvarDecl **ClsFields =
+ reinterpret_cast<ObjcIvarDecl**>(&RecFields[0]);
+ cast<ObjcInterfaceDecl>(static_cast<Decl*>(RecDecl))->
+ ObjcAddInstanceVariablesToClass(ClsFields, RecFields.size());
+ }
}
void Sema::ObjcAddMethodsToClass(DeclTy *ClassDecl,