Make 'findPropertyDecl()' a static method of ObjCPropertyDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98570 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index c94a551..597b0d1 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -89,6 +89,19 @@
return 0;
}
+ObjCPropertyDecl *
+ObjCPropertyDecl::findPropertyDecl(DeclContext *DC,
+ IdentifierInfo *propertyID) {
+
+ DeclContext::lookup_iterator I, E;
+ llvm::tie(I, E) = DC->lookup(propertyID);
+ for ( ; I != E; ++I)
+ if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(*I))
+ return PD;
+
+ return 0;
+}
+
/// FindPropertyDeclaration - Finds declaration of the property given its name
/// in 'PropertyId' and returns it. It returns 0, if not found.
/// FIXME: Convert to DeclContext lookup...
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 7659062..3a0fe0a 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -66,18 +66,6 @@
Attributes, T, MethodImplKind));
}
-static ObjCPropertyDecl *findPropertyDecl(DeclContext *DC,
- IdentifierInfo *propertyID) {
-
- DeclContext::lookup_iterator I, E;
- llvm::tie(I, E) = DC->lookup(propertyID);
- for ( ; I != E; ++I)
- if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(*I))
- return PD;
-
- return 0;
-}
-
Sema::DeclPtrTy
Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
SourceLocation AtLoc, FieldDeclarator &FD,
@@ -93,7 +81,8 @@
DeclContext *DC = cast<DeclContext>(CDecl);
IdentifierInfo *PropertyId = FD.D.getIdentifier();
- if (ObjCPropertyDecl *prevDecl = findPropertyDecl(DC, PropertyId)) {
+ if (ObjCPropertyDecl *prevDecl =
+ ObjCPropertyDecl::findPropertyDecl(DC, PropertyId)) {
Diag(AtLoc, diag::err_duplicate_property);
Diag(prevDecl->getLocation(), diag::note_property_declare);
return DeclPtrTy();
@@ -231,7 +220,8 @@
FD.D.getIdentifierLoc(),
PropertyId, AtLoc, T);
- if (ObjCPropertyDecl *prevDecl = findPropertyDecl(DC, PropertyId)) {
+ if (ObjCPropertyDecl *prevDecl =
+ ObjCPropertyDecl::findPropertyDecl(DC, PropertyId)) {
Diag(PDecl->getLocation(), diag::err_duplicate_property);
Diag(prevDecl->getLocation(), diag::note_property_declare);
PDecl->setInvalidDecl();