[cfe-commits] r98794 - /cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Ted Kremenek kremenek at apple.com
Wed Mar 17 18:22:36 PDT 2010


Author: kremenek
Date: Wed Mar 17 20:22:36 2010
New Revision: 98794

URL: http://llvm.org/viewvc/llvm-project?rev=98794&view=rev
Log:
Simplify code (and remove 'dyn_cast') by using ObjCProperyDecl::findPropertyDecl().

Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=98794&r1=98793&r2=98794&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed Mar 17 20:22:36 2010
@@ -137,17 +137,9 @@
       Diag(AtLoc, diag::warn_property_attr_mismatch);
       Diag(PIDecl->getLocation(), diag::note_property_declare);
     }
-    DeclContext *DC = dyn_cast<DeclContext>(CCPrimary);
-    assert(DC && "ClassDecl is not a DeclContext");
-    DeclContext::lookup_result Found =
-    DC->lookup(PIDecl->getDeclName());
-    bool PropertyInPrimaryClass = false;
-    for (; Found.first != Found.second; ++Found.first)
-      if (isa<ObjCPropertyDecl>(*Found.first)) {
-        PropertyInPrimaryClass = true;
-        break;
-      }
-    if (!PropertyInPrimaryClass) {
+    DeclContext *DC = cast<DeclContext>(CCPrimary);
+    if (!ObjCPropertyDecl::findPropertyDecl(DC,
+                                 PIDecl->getDeclName().getAsIdentifierInfo())) {
       // Protocol is not in the primary class. Must build one for it.
       ObjCDeclSpec ProtocolPropertyODS;
       // FIXME. Assuming that ObjCDeclSpec::ObjCPropertyAttributeKind





More information about the cfe-commits mailing list