summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-12-06 23:03:39 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-12-06 23:03:39 +0000
commitd2c2ad515e33ebf700942e90cddb4b72cc738d70 (patch)
tree619670989d3bd51cc3b99de6cd57af975d3004cf /clang/lib/AST
parentda93063acc9077f9607ae92c590738414f0030f2 (diff)
downloadbcm5719-llvm-d2c2ad515e33ebf700942e90cddb4b72cc738d70.tar.gz
bcm5719-llvm-d2c2ad515e33ebf700942e90cddb4b72cc738d70.zip
Use of properties declared in protocols in the category
via the category's protocol list1s, with appropriate diagnsostics and a test case. llvm-svn: 60634
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/DeclObjC.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 58d0383d1fe..0458282fb38 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -513,6 +513,31 @@ void ObjCCategoryDecl::addPropertyMethods(
::addPropertyMethods(this, Context, property, insMethods, InsMap);
}
+/// mergeProperties - Adds properties to the end of list of current properties
+/// for this category.
+
+void ObjCCategoryDecl::mergeProperties(ObjCPropertyDecl **Properties,
+ unsigned NumNewProperties) {
+ if (NumNewProperties == 0) return;
+
+ if (PropertyDecl) {
+ ObjCPropertyDecl **newPropertyDecl =
+ new ObjCPropertyDecl*[NumNewProperties + NumPropertyDecl];
+ ObjCPropertyDecl **buf = newPropertyDecl;
+ // put back original properties in buffer.
+ memcpy(buf, PropertyDecl, NumPropertyDecl*sizeof(ObjCPropertyDecl*));
+ // Add new properties to this buffer.
+ memcpy(buf+NumPropertyDecl, Properties,
+ NumNewProperties*sizeof(ObjCPropertyDecl*));
+ delete[] PropertyDecl;
+ PropertyDecl = newPropertyDecl;
+ NumPropertyDecl += NumNewProperties;
+ }
+ else {
+ addProperties(Properties, NumNewProperties);
+ }
+}
+
/// addPropertyMethods - Goes through list of properties declared in this class
/// and builds setter/getter method declartions depending on the setter/getter
/// attributes of the property.
OpenPOWER on IntegriCloud