[cfe-commits] r83326 - in /cfe/trunk/lib: AST/DeclObjC.cpp Sema/SemaDeclObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Mon Oct 5 14:32:49 PDT 2009


Author: fjahanian
Date: Mon Oct  5 16:32:49 2009
New Revision: 83326

URL: http://llvm.org/viewvc/llvm-project?rev=83326&view=rev
Log:
tweaked my last patch to 1) preserve the protocol in
extension class's protocol list so its AST is complete.
2) Because of this no need to issue warning on unimplemeted
methods coming from the extended class protocols
because warning is issued when class definition is seen.


Modified:
    cfe/trunk/lib/AST/DeclObjC.cpp
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=83326&r1=83325&r2=83326&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Mon Oct  5 16:32:49 2009
@@ -148,15 +148,13 @@
   }
   if (ProtocolRefs.empty())
     return;
-  
+  // Merge ProtocolRefs into class's protocol list;
   for (protocol_iterator p = protocol_begin(), e = protocol_end();
        p != e; p++)
     ProtocolRefs.push_back(*p);
   ReferencedProtocols.Destroy(C);
   unsigned NumProtoRefs = ProtocolRefs.size();
   setProtocolList((ObjCProtocolDecl**)&ProtocolRefs[0], NumProtoRefs, C);
-  // Merge ProtocolRefs into class's protocol list;
-  
 }
 
 ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID,

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=83326&r1=83325&r2=83326&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Oct  5 16:32:49 2009
@@ -588,15 +588,13 @@
     CDecl->insertNextClassCategory();
 
   if (NumProtoRefs) {
+    CDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs, 
+                           Context);
+    CDecl->setLocEnd(EndProtoLoc);
     // Protocols in the class extension belong to the class.
     if (!CDecl->getIdentifier())
      IDecl->mergeClassExtensionProtocolList((ObjCProtocolDecl**)ProtoRefs, 
                                             NumProtoRefs,Context); 
-    else {
-      CDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs,
-                             Context);
-      CDecl->setLocEnd(EndProtoLoc);
-    }
   }
 
   CheckObjCDeclScope(CDecl);
@@ -1102,10 +1100,14 @@
       }
     }
   } else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl)) {
-    for (ObjCCategoryDecl::protocol_iterator PI = C->protocol_begin(),
-         E = C->protocol_end(); PI != E; ++PI)
-      CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl,
-                              InsMap, ClsMap, C->getClassInterface());
+    // For extended class, unimplemented methods in its protocols will
+    // be reported in the primary class.
+    if (C->getIdentifier()) {
+      for (ObjCCategoryDecl::protocol_iterator PI = C->protocol_begin(),
+           E = C->protocol_end(); PI != E; ++PI)
+        CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl,
+                                InsMap, ClsMap, C->getClassInterface());
+    }
   } else
     assert(false && "invalid ObjCContainerDecl type.");
 }





More information about the cfe-commits mailing list