diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2008-05-02 19:17:30 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-05-02 19:17:30 +0000 |
commit | 98a6c4fa77f21368a32a5a853a3899ac1016267e (patch) | |
tree | c5be492e7c28b86443f52ba2a3fdbb76a858f430 /clang/lib/AST/DeclObjC.cpp | |
parent | 5f0563ceb605b35a109dd96ce5f69860169fe5c0 (diff) | |
download | bcm5719-llvm-98a6c4fa77f21368a32a5a853a3899ac1016267e.tar.gz bcm5719-llvm-98a6c4fa77f21368a32a5a853a3899ac1016267e.zip |
This patch is about merging ObjC2's properties declared in class
protocols into class's property list and performing semantics
on them for while doing so.
llvm-svn: 50587
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index ef4a6e1c3d0..89f6d2c5019 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -242,6 +242,33 @@ void ObjCInterfaceDecl::addProperties(ObjCPropertyDecl **Properties, memcpy(PropertyDecl, Properties, NumProperties*sizeof(ObjCPropertyDecl*)); } +/// mergeProperties - Adds properties to the end of list of current properties +/// for this class. + +void ObjCInterfaceDecl::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*)); + free(PropertyDecl); + PropertyDecl = newPropertyDecl; + NumPropertyDecl += NumNewProperties; + } + else { + PropertyDecl = new ObjCPropertyDecl*[NumNewProperties]; + memcpy(PropertyDecl, Properties, NumNewProperties*sizeof(ObjCPropertyDecl*)); + NumPropertyDecl = NumNewProperties; + } +} + /// addProperties - Insert property declaration AST nodes into /// ObjCProtocolDecl's PropertyDecl field. /// |