aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-03-15 20:30:07 +0000
committerTed Kremenek <kremenek@apple.com>2010-03-15 20:30:07 +0000
commit37cafb077ad5b170acae77e566638603011ef4c0 (patch)
treed2e500d00ca72aa48b58cecb740510e248c82965
parentde09d0c9694f01a99870a8825266d44a29ebb325 (diff)
Move method FindPropertyVisibleInPrimaryClass() from ObjCContainerDecl to ObjCInterfaceDecl.
Also change this method to lookup property declarations using DeclContext::lookup(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98574 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/DeclObjC.h7
-rw-r--r--lib/AST/DeclObjC.cpp19
2 files changed, 13 insertions, 13 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index 04867db827..a1f565341e 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -381,8 +381,6 @@ public:
ObjCIvarDecl *getIvarDecl(IdentifierInfo *Id) const;
ObjCPropertyDecl *FindPropertyDeclaration(IdentifierInfo *PropertyId) const;
- ObjCPropertyDecl *FindPropertyVisibleInPrimaryClass(
- IdentifierInfo *PropertyId) const;
// Marks the end of the container.
SourceRange getAtEndRange() const {
@@ -535,7 +533,10 @@ public:
}
ObjCCategoryDecl* getClassExtension() const;
-
+
+ ObjCPropertyDecl
+ *FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId) const;
+
/// isSuperClassOf - Return true if this class is the specified class or is a
/// super class of the specified interface class.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const {
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 6a03360d16..7d1033d4f1 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -159,22 +159,21 @@ ObjCContainerDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const {
/// FindPropertyVisibleInPrimaryClass - Finds declaration of the property
/// with name 'PropertyId' in the primary class; including those in protocols
-/// (direct or indirect) used by the promary class.
-/// FIXME: Convert to DeclContext lookup...
+/// (direct or indirect) used by the primary class.
///
ObjCPropertyDecl *
-ObjCContainerDecl::FindPropertyVisibleInPrimaryClass(
+ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass(
IdentifierInfo *PropertyId) const {
- assert(isa<ObjCInterfaceDecl>(this) && "FindPropertyVisibleInPrimaryClass");
- for (prop_iterator I = prop_begin(), E = prop_end(); I != E; ++I)
- if ((*I)->getIdentifier() == PropertyId)
- return *I;
- const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(this);
+ if (ObjCPropertyDecl *PD =
+ ObjCPropertyDecl::findPropertyDecl(cast<DeclContext>(this), PropertyId))
+ return PD;
+
// Look through protocols.
- for (ObjCInterfaceDecl::protocol_iterator I = OID->protocol_begin(),
- E = OID->protocol_end(); I != E; ++I)
+ for (ObjCInterfaceDecl::protocol_iterator
+ I = protocol_begin(), E = protocol_end(); I != E; ++I)
if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId))
return P;
+
return 0;
}