diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-09 21:04:52 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-09 21:04:52 +0000 |
commit | 519976c4e92b635bf66e5ec469071d5ba5acf6ab (patch) | |
tree | 490ce62c0b75721af9b40270348bb6f2073f22bf /clang/lib/AST/DeclObjC.cpp | |
parent | c1f5a659dea70e94c8053ec60f842a657fd955d7 (diff) | |
download | bcm5719-llvm-519976c4e92b635bf66e5ec469071d5ba5acf6ab.tar.gz bcm5719-llvm-519976c4e92b635bf66e5ec469071d5ba5acf6ab.zip |
This patch removes mergeProperties and does the property lookup
in designated protocols lazily.
llvm-svn: 62007
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 98d7164ba35..56da9a6dfa9 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -378,31 +378,6 @@ unsigned ObjCContainerDecl::getNumClassMethods() const { return sum; } -/// mergeProperties - Adds properties to the end of list of current properties -/// for this class. - -void ObjCContainerDecl::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); - } -} - /// addProperties - Insert property declaration AST nodes into /// ObjCContainerDecl's PropertyDecl field. /// @@ -425,6 +400,16 @@ ObjCContainerDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const { if (property->getIdentifier() == PropertyId) return property; } + const ObjCProtocolDecl *PID = dyn_cast<ObjCProtocolDecl>(this); + if (PID) { + for (ObjCProtocolDecl::protocol_iterator P = PID->protocol_begin(), + E = PID->protocol_end(); + P != E; ++P) + if (ObjCPropertyDecl *property = + (*P)->FindPropertyDeclaration(PropertyId)) + return property; + } + const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(this); if (OID) { // Look through categories. |