void addProperties(ObjCPropertyDecl **Properties, unsigned NumProperties);
- // FIXME: Replace with appropriate lookup. Currently used by interfaces and
- // categories.
- void mergeProperties(ObjCPropertyDecl **Properties, unsigned NumProperties);
-
typedef ObjCPropertyDecl * const * prop_iterator;
prop_iterator prop_begin() const { return PropertyDecl; }
prop_iterator prop_end() const {
// found, we search referenced protocols and class categories.
ObjCMethodDecl *lookupInstanceMethod(Selector Sel);
ObjCMethodDecl *lookupClassMethod(Selector Sel);
-
+
bool isForwardDecl() const { return isForwardProtoDecl; }
void setForwardDecl(bool val) { isForwardProtoDecl = val; }
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.
///
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.
void
Sema::MergeOneProtocolPropertiesIntoClass(Decl *CDecl,
ObjCProtocolDecl *PDecl) {
- llvm::SmallVector<ObjCPropertyDecl*, 16> mergeProperties;
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDecl);
if (!IDecl) {
// Category
CP != CE; ++CP)
if ((*CP)->getIdentifier() == Pr->getIdentifier())
break;
- if (CP == CE)
- // Add this property to list of properties for thie class.
- mergeProperties.push_back(Pr);
- else
+ if (CP != CE)
// Property protocol already exist in class. Diagnose any mismatch.
DiagnosePropertyMismatch((*CP), Pr, PDecl->getIdentifier());
}
- CatDecl->mergeProperties(&mergeProperties[0], mergeProperties.size());
return;
}
for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(),
CP != CE; ++CP)
if ((*CP)->getIdentifier() == Pr->getIdentifier())
break;
- if (CP == CE)
- // Add this property to list of properties for thie class.
- mergeProperties.push_back(Pr);
- else
+ if (CP != CE)
// Property protocol already exist in class. Diagnose any mismatch.
DiagnosePropertyMismatch((*CP), Pr, PDecl->getIdentifier());
}
- IDecl->mergeProperties(&mergeProperties[0], mergeProperties.size());
}
/// MergeProtocolPropertiesIntoClass - This routine merges properties
int newO;
int oldO;
}
-@property (retain) id MayCauseError; // expected-warning {{property 'MayCauseError' 'copy' attribute does not match the property inherited from 'GCObject'}} \
- expected-warning {{property 'MayCauseError' 'copy' attribute does not match the property inherited from 'ProtocolObject'}}
+@property (retain) id MayCauseError; // expected-warning {{property 'MayCauseError' 'copy' attribute does not match the property inherited from 'ProtocolObject'}}
@end