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/Sema.h b/Sema/Sema.h
index 1e74321..2b50f5e 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -369,9 +369,9 @@
tok::TokenKind MethodType, TypeTy *ReturnType,
IdentifierInfo *SelectorName, AttributeList *AttrList);
- virtual void ObjcAddInstanceVariable(DeclTy *ClassDec, DeclTy **Ivar,
- unsigned numIvars,
- tok::ObjCKeywordKind *visibility);
+ virtual void ObjcAddVisibilityToIvars(DeclTy *ClassDec, DeclTy **Ivar,
+ unsigned numIvars,
+ tok::ObjCKeywordKind *visibility);
private:
// UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
// functions and arrays to their respective pointers (C99 6.3.2.1).
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,