diff options
author | Anna Zaks <ganna@apple.com> | 2012-10-18 19:17:53 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-10-18 19:17:53 +0000 |
commit | b36ea375e20f71df19c101fa2399b7ea3a607e04 (patch) | |
tree | 3dff56c7523d88da9b3ecebc798159631ebbd9f5 /lib/AST/DeclObjC.cpp | |
parent | a7a68b61e809a74fb5d34d57d7429fcc95e1ccad (diff) |
Factor CollectClassPropertyImplementations out of Sema into AST
This would make it possible for the analyzer to use the function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 2dbb353af3..5eb9cdc5dc 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -190,6 +190,18 @@ ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass( return 0; } +void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap& PM) const { + for (ObjCContainerDecl::prop_iterator P = prop_begin(), + E = prop_end(); P != E; ++P) { + ObjCPropertyDecl *Prop = *P; + PM[Prop->getIdentifier()] = Prop; + } + for (ObjCInterfaceDecl::all_protocol_iterator + PI = all_referenced_protocol_begin(), + E = all_referenced_protocol_end(); PI != E; ++PI) + (*PI)->collectPropertiesToImplement(PM); +} + void ObjCInterfaceDecl::mergeClassExtensionProtocolList( ObjCProtocolDecl *const* ExtList, unsigned ExtNum, ASTContext &C) @@ -1313,6 +1325,20 @@ void ObjCProtocolDecl::startDefinition() { RD->Data = this->Data; } +void ObjCProtocolDecl::collectPropertiesToImplement(PropertyMap& PM) const { + for (ObjCProtocolDecl::prop_iterator P = prop_begin(), + E = prop_end(); P != E; ++P) { + ObjCPropertyDecl *Prop = *P; + // Insert into PM if not there already. + PM.insert(std::make_pair(Prop->getIdentifier(), Prop)); + } + // Scan through protocol's protocols. + for (ObjCProtocolDecl::protocol_iterator PI = protocol_begin(), + E = protocol_end(); PI != E; ++PI) + (*PI)->collectPropertiesToImplement(PM); +} + + //===----------------------------------------------------------------------===// // ObjCCategoryDecl //===----------------------------------------------------------------------===// |