This patch adds support for declaraing properties in categories,
just as they are declared in objc classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49817 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 7a99f0f..c9c5132 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -185,8 +185,8 @@
AtEndLoc = endLoc;
}
-/// addMethods - Insert instance and methods declarations into
-/// ObjCInterfaceDecl's InsMethods and ClsMethods fields.
+/// addProperties - Insert property declaration AST nodes into
+/// ObjCInterfaceDecl's PropertyDecl field.
///
void ObjCInterfaceDecl::addProperties(ObjCPropertyDecl **Properties,
unsigned NumProperties) {
@@ -197,6 +197,18 @@
memcpy(PropertyDecl, Properties, NumProperties*sizeof(ObjCPropertyDecl*));
}
+/// addProperties - Insert property declaration AST nodes into
+/// ObjCProtocolDecl's PropertyDecl field.
+///
+void ObjCCategoryDecl::addProperties(ObjCPropertyDecl **Properties,
+ unsigned NumProperties) {
+ if (NumProperties == 0) return;
+
+ NumPropertyDecl = NumProperties;
+ PropertyDecl = new ObjCPropertyDecl*[NumProperties];
+ memcpy(PropertyDecl, Properties, NumProperties*sizeof(ObjCPropertyDecl*));
+}
+
/// addMethods - Insert instance and methods declarations into
/// ObjCProtocolDecl's ProtoInsMethods and ProtoClsMethods fields.
///