]> granicus.if.org Git - clang/commitdiff
Simplify code (and remove 'dyn_cast') by using ObjCProperyDecl::findPropertyDecl().
authorTed Kremenek <kremenek@apple.com>
Thu, 18 Mar 2010 01:22:36 +0000 (01:22 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 18 Mar 2010 01:22:36 +0000 (01:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98794 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaObjCProperty.cpp

index 3a0fe0a61afe8eb681fcb42f88b538ea5ebc87d4..41ed6c630cb2f2dee64018ca3aa7a7ce39a32e94 100644 (file)
@@ -137,17 +137,9 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
       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