[cfe-commits] r98570 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp lib/Sema/SemaObjCProperty.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 15 13:11:46 PDT 2010
Author: kremenek
Date: Mon Mar 15 15:11:46 2010
New Revision: 98570
URL: http://llvm.org/viewvc/llvm-project?rev=98570&view=rev
Log:
Make 'findPropertyDecl()' a static method of ObjCPropertyDecl.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=98570&r1=98569&r2=98570&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Mon Mar 15 15:11:46 2010
@@ -1327,6 +1327,10 @@
return PropertyIvarDecl;
}
+ /// Lookup a property by name in the specified DeclContext.
+ static ObjCPropertyDecl *findPropertyDecl(DeclContext *DC,
+ IdentifierInfo *propertyID);
+
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const ObjCPropertyDecl *D) { return true; }
static bool classofKind(Kind K) { return K == ObjCProperty; }
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=98570&r1=98569&r2=98570&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Mon Mar 15 15:11:46 2010
@@ -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...
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=98570&r1=98569&r2=98570&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Mar 15 15:11:46 2010
@@ -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();
More information about the cfe-commits
mailing list