diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2008-12-06 23:03:39 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-12-06 23:03:39 +0000 |
commit | 1ac2bc44781ec8451f880dcf586768a71824d3a6 (patch) | |
tree | 7b745438d57bc6f1b279011fef6ac9f9eeffb910 /lib/AST/DeclObjC.cpp | |
parent | 601bae3b1d3c06e8c91f6ea77dd2b0315353ee0b (diff) |
Use of properties declared in protocols in the category
via the category's protocol list1s, with appropriate
diagnsostics and a test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 58d0383d1f..0458282fb3 100644 --- a/lib/AST/DeclObjC.cpp +++ b/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. |