diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-02-14 22:33:34 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-02-14 22:33:34 +0000 |
commit | cfaed8d399a34e79fbab9f70eb4ea1bbeb81a02b (patch) | |
tree | 9fc8d863728dee252339c135914bb0ca26b40b74 /lib/AST | |
parent | 62d0f569360a664018316e4a21a4e960560b271d (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 6e740bfa09..d539e0098f 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -217,16 +217,18 @@ ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass( return 0; } -void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap &PM) const { +void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap &PM, + PropertyDeclOrder &PO) const { for (ObjCContainerDecl::prop_iterator P = prop_begin(), E = prop_end(); P != E; ++P) { ObjCPropertyDecl *Prop = *P; PM[Prop->getIdentifier()] = Prop; + PO.push_back(Prop); } for (ObjCInterfaceDecl::all_protocol_iterator PI = all_referenced_protocol_begin(), E = all_referenced_protocol_end(); PI != E; ++PI) - (*PI)->collectPropertiesToImplement(PM); + (*PI)->collectPropertiesToImplement(PM, PO); // Note, the properties declared only in class extensions are still copied // into the main @interface's property list, and therefore we don't // explicitly, have to search class extension properties. @@ -1433,7 +1435,8 @@ void ObjCProtocolDecl::startDefinition() { RD->Data = this->Data; } -void ObjCProtocolDecl::collectPropertiesToImplement(PropertyMap &PM) const { +void ObjCProtocolDecl::collectPropertiesToImplement(PropertyMap &PM, + PropertyDeclOrder &PO) const { if (const ObjCProtocolDecl *PDecl = getDefinition()) { for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(), @@ -1441,11 +1444,12 @@ void ObjCProtocolDecl::collectPropertiesToImplement(PropertyMap &PM) const { ObjCPropertyDecl *Prop = *P; // Insert into PM if not there already. PM.insert(std::make_pair(Prop->getIdentifier(), Prop)); + PO.push_back(Prop); } // Scan through protocol's protocols. for (ObjCProtocolDecl::protocol_iterator PI = PDecl->protocol_begin(), E = PDecl->protocol_end(); PI != E; ++PI) - (*PI)->collectPropertiesToImplement(PM); + (*PI)->collectPropertiesToImplement(PM, PO); } } |