[cfe-commits] r98574 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 15 13:30:07 PDT 2010
Author: kremenek
Date: Mon Mar 15 15:30:07 2010
New Revision: 98574
URL: http://llvm.org/viewvc/llvm-project?rev=98574&view=rev
Log:
Move method FindPropertyVisibleInPrimaryClass() from ObjCContainerDecl to ObjCInterfaceDecl.
Also change this method to lookup property declarations using DeclContext::lookup().
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=98574&r1=98573&r2=98574&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Mon Mar 15 15:30:07 2010
@@ -381,8 +381,6 @@
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 @@
}
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 {
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=98574&r1=98573&r2=98574&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Mon Mar 15 15:30:07 2010
@@ -159,22 +159,21 @@
/// 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;
}
More information about the cfe-commits
mailing list