summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-02-14 22:33:34 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-02-14 22:33:34 +0000
commitaedaaa4f35a5fcae89a8a22f6882e6456da0acbf (patch)
treebef131b41d06d55253793a8d80736444df6f5cc8 /clang/lib/Sema
parent55fcb1054276dcefbf32fb95be7e28ce2ef39d33 (diff)
downloadbcm5719-llvm-aedaaa4f35a5fcae89a8a22f6882e6456da0acbf.tar.gz
bcm5719-llvm-aedaaa4f35a5fcae89a8a22f6882e6456da0acbf.zip
objective-C: synthesize properties in order of their
declarations to synthesize their ivars in similar determinstic order so they are laid out in a determinstic order. // rdar://13192366 llvm-svn: 175214
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index e238b7ea20d..e046faa04d0 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -1534,8 +1534,9 @@ void Sema::CollectImmediateProperties(ObjCContainerDecl *CDecl,
static void CollectSuperClassPropertyImplementations(ObjCInterfaceDecl *CDecl,
ObjCInterfaceDecl::PropertyMap &PropMap) {
if (ObjCInterfaceDecl *SDecl = CDecl->getSuperClass()) {
+ ObjCInterfaceDecl::PropertyDeclOrder PO;
while (SDecl) {
- SDecl->collectPropertiesToImplement(PropMap);
+ SDecl->collectPropertiesToImplement(PropMap, PO);
SDecl = SDecl->getSuperClass();
}
}
@@ -1574,15 +1575,15 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
ObjCInterfaceDecl *IDecl) {
ObjCInterfaceDecl::PropertyMap PropMap;
- IDecl->collectPropertiesToImplement(PropMap);
+ ObjCInterfaceDecl::PropertyDeclOrder PropertyOrder;
+ IDecl->collectPropertiesToImplement(PropMap, PropertyOrder);
if (PropMap.empty())
return;
ObjCInterfaceDecl::PropertyMap SuperPropMap;
CollectSuperClassPropertyImplementations(IDecl, SuperPropMap);
- for (ObjCInterfaceDecl::PropertyMap::iterator
- P = PropMap.begin(), E = PropMap.end(); P != E; ++P) {
- ObjCPropertyDecl *Prop = P->second;
+ for (unsigned i = 0, e = PropertyOrder.size(); i != e; i++) {
+ ObjCPropertyDecl *Prop = PropertyOrder[i];
// If property to be implemented in the super class, ignore.
if (SuperPropMap[Prop->getIdentifier()])
continue;
@@ -1648,8 +1649,10 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl,
// For categories, no need to implement properties declared in
// its primary class (and its super classes) if property is
// declared in one of those containers.
- if ((IDecl = C->getClassInterface()))
- IDecl->collectPropertiesToImplement(NoNeedToImplPropMap);
+ if ((IDecl = C->getClassInterface())) {
+ ObjCInterfaceDecl::PropertyDeclOrder PO;
+ IDecl->collectPropertiesToImplement(NoNeedToImplPropMap, PO);
+ }
}
if (IDecl)
CollectSuperClassPropertyImplementations(IDecl, NoNeedToImplPropMap);
OpenPOWER on IntegriCloud