[cfe-commits] r99730 - in /cfe/trunk: lib/Sema/Sema.h lib/Sema/SemaDeclObjC.cpp test/SemaObjC/method-undef-category-warn-1.m

Fariborz Jahanian fjahanian at apple.com
Sat Mar 27 14:10:05 PDT 2010


Author: fjahanian
Date: Sat Mar 27 16:10:05 2010
New Revision: 99730

URL: http://llvm.org/viewvc/llvm-project?rev=99730&view=rev
Log:
Further improvement to point to category
whose protocolls methods needs implementation.

Modified:
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/test/SemaObjC/method-undef-category-warn-1.m

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=99730&r1=99729&r2=99730&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Mar 27 16:10:05 2010
@@ -1452,7 +1452,7 @@
                                bool& IncompleteImpl,
                                const llvm::DenseSet<Selector> &InsMap,
                                const llvm::DenseSet<Selector> &ClsMap,
-                               ObjCInterfaceDecl *IDecl);
+                               ObjCContainerDecl *CDecl);
 
   /// CheckImplementationIvars - This routine checks if the instance variables
   /// listed in the implelementation match those listed in the interface.

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=99730&r1=99729&r2=99730&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sat Mar 27 16:10:05 2010
@@ -769,7 +769,14 @@
                                    bool& IncompleteImpl,
                                    const llvm::DenseSet<Selector> &InsMap,
                                    const llvm::DenseSet<Selector> &ClsMap,
-                                   ObjCInterfaceDecl *IDecl) {
+                                   ObjCContainerDecl *CDecl) {
+  ObjCInterfaceDecl *IDecl;
+  if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl))
+    IDecl = C->getClassInterface();
+  else
+    IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl);
+  assert (IDecl && "CheckProtocolMethodDefs - IDecl is null");
+  
   ObjCInterfaceDecl *Super = IDecl->getSuperClass();
   ObjCInterfaceDecl *NSIDecl = 0;
   if (getLangOptions().NeXTRuntime) {
@@ -809,7 +816,7 @@
             IDecl->lookupInstanceMethod(method->getSelector());
             if (!MethodInClass || !MethodInClass->isSynthesized()) {
               WarnUndefinedMethod(ImpLoc, method, IncompleteImpl);
-              Diag(IDecl->getLocation(), diag::note_required_for_protocol_at) <<
+              Diag(CDecl->getLocation(), diag::note_required_for_protocol_at) <<
                 PDecl->getDeclName();
             }
           }
@@ -955,7 +962,7 @@
       for (ObjCCategoryDecl::protocol_iterator PI = C->protocol_begin(),
            E = C->protocol_end(); PI != E; ++PI)
         CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl,
-                                InsMap, ClsMap, C->getClassInterface());
+                                InsMap, ClsMap, CDecl);
       // Report unimplemented properties in the category as well.
       // When reporting on missing setter/getters, do not report when
       // setter/getter is implemented in category's primary class 

Modified: cfe/trunk/test/SemaObjC/method-undef-category-warn-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-undef-category-warn-1.m?rev=99730&r1=99729&r2=99730&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/method-undef-category-warn-1.m (original)
+++ cfe/trunk/test/SemaObjC/method-undef-category-warn-1.m Sat Mar 27 16:10:05 2010
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
- at interface MyClass1  // expected-note 2 {{required for direct or indirect protocol 'P'}}
+ at interface MyClass1
 @end
 
 @protocol P
@@ -8,7 +8,7 @@
 - (void) Pmeth1;   // expected-note {{method definition for 'Pmeth1' not found}}
 @end
 
- at interface MyClass1(CAT) <P>
+ at interface MyClass1(CAT) <P> // expected-note {{required for direct or indirect protocol 'P'}}
 - (void) meth2;	 // expected-note {{method definition for 'meth2' not found}}
 @end
 
@@ -16,7 +16,7 @@
 - (void) Pmeth1{}
 @end
 
- at interface MyClass1(DOG) <P>
+ at interface MyClass1(DOG) <P> // expected-note {{required for direct or indirect protocol 'P'}}
 - (void)ppp;    // expected-note {{method definition for 'ppp' not found}}
 @end
 





More information about the cfe-commits mailing list