aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-01-09 21:04:52 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-01-09 21:04:52 +0000
commita66793ee8d2589ead81739d9b8a968650db3d452 (patch)
tree08bf49c9e69c2c71f016f5627a0f6f92979366b9 /lib/AST/DeclObjC.cpp
parent8fa73ed04dfad53696813cbd68058478d6c0becf (diff)
This patch removes mergeProperties and does the property lookup
in designated protocols lazily. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp35
1 files changed, 10 insertions, 25 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 98d7164ba3..56da9a6dfa 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/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.