]> granicus.if.org Git - clang/commitdiff
Mostly renaming some methods and updating comments to
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 18 Jan 2010 18:41:16 +0000 (18:41 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 18 Jan 2010 18:41:16 +0000 (18:41 +0000)
reflect what these methods are actually doing. One method
template for future work. No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93742 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
lib/Sema/SemaDeclObjC.cpp

index 02e3a7a93d410e3ca473129a737cc4a397266781..b273feb5b2609fcfa97e94171f7565078078e962 100644 (file)
@@ -1278,6 +1278,9 @@ public:
                                const llvm::DenseSet<Selector> &InsMap,
                                const llvm::DenseSet<Selector> &ClsMap,
                                ObjCInterfaceDecl *IDecl);
+  
+  void CheckPropertyImplementation(ObjCImplDecl* IMPDecl,
+                                   ObjCInterfaceDecl *CDecl);
 
   /// CheckImplementationIvars - This routine checks if the instance variables
   /// listed in the implelementation match those listed in the interface.
@@ -3409,14 +3412,13 @@ public:
                                          ObjCMethodDecl *MethodDecl,
                                          bool IsInstance);
 
-  void MergeProtocolPropertiesIntoClass(Decl *CDecl,
-                                        DeclPtrTy MergeProtocols);
+  void CompareProperties(Decl *CDecl, DeclPtrTy MergeProtocols);
 
   void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
                                         ObjCInterfaceDecl *ID);
 
-  void MergeOneProtocolPropertiesIntoClass(Decl *CDecl,
-                                           ObjCProtocolDecl *PDecl);
+  void MatchOneProtocolPropertiesInClass(Decl *CDecl,
+                                         ObjCProtocolDecl *PDecl);
 
   virtual void ActOnAtEnd(SourceRange AtEnd,
                           DeclPtrTy classDecl,
index ba21df776e175b53dc73e24219f88aaedfc8e14a..c0cbc416d94d13f45350c4a18a984a0cb0fb5bce 100644 (file)
@@ -435,17 +435,17 @@ void Sema::ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl) {
   }
 }
 
-/// MergeOneProtocolPropertiesIntoClass - This routine goes thru the list
-/// of properties declared in a protocol and adds them to the list
-/// of properties for current class/category if it is not there already.
+/// MatchOneProtocolPropertiesInClass - This routine goes thru the list
+/// of properties declared in a protocol and compares their attribute against
+/// the same property declared in the class or category.
 void
-Sema::MergeOneProtocolPropertiesIntoClass(Decl *CDecl,
+Sema::MatchOneProtocolPropertiesInClass(Decl *CDecl,
                                           ObjCProtocolDecl *PDecl) {
   ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDecl);
   if (!IDecl) {
     // Category
     ObjCCategoryDecl *CatDecl = static_cast<ObjCCategoryDecl*>(CDecl);
-    assert (CatDecl && "MergeOneProtocolPropertiesIntoClass");
+    assert (CatDecl && "MatchOneProtocolPropertiesInClass");
     for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(),
          E = PDecl->prop_end(); P != E; ++P) {
       ObjCPropertyDecl *Pr = (*P);
@@ -474,35 +474,35 @@ Sema::MergeOneProtocolPropertiesIntoClass(Decl *CDecl,
     }
 }
 
-/// MergeProtocolPropertiesIntoClass - This routine merges properties
-/// declared in 'MergeItsProtocols' objects (which can be a class or an
-/// inherited protocol into the list of properties for class/category 'CDecl'
+/// CompareProperties - This routine compares properties
+/// declared in 'ClassOrProtocol' objects (which can be a class or an
+/// inherited protocol with the list of properties for class/category 'CDecl'
 ///
-void Sema::MergeProtocolPropertiesIntoClass(Decl *CDecl,
-                                            DeclPtrTy MergeItsProtocols) {
-  Decl *ClassDecl = MergeItsProtocols.getAs<Decl>();
+void Sema::CompareProperties(Decl *CDecl,
+                             DeclPtrTy ClassOrProtocol) {
+  Decl *ClassDecl = ClassOrProtocol.getAs<Decl>();
   ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDecl);
 
   if (!IDecl) {
     // Category
     ObjCCategoryDecl *CatDecl = static_cast<ObjCCategoryDecl*>(CDecl);
-    assert (CatDecl && "MergeProtocolPropertiesIntoClass");
+    assert (CatDecl && "CompareProperties");
     if (ObjCCategoryDecl *MDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {
       for (ObjCCategoryDecl::protocol_iterator P = MDecl->protocol_begin(),
            E = MDecl->protocol_end(); P != E; ++P)
-      // Merge properties of category (*P) into IDECL's
-      MergeOneProtocolPropertiesIntoClass(CatDecl, *P);
+      // Match properties of category with those of protocol (*P)
+      MatchOneProtocolPropertiesInClass(CatDecl, *P);
 
-      // Go thru the list of protocols for this category and recursively merge
-      // their properties into this class as well.
+      // Go thru the list of protocols for this category and recursively match
+      // their properties with those in the category.
       for (ObjCCategoryDecl::protocol_iterator P = CatDecl->protocol_begin(),
            E = CatDecl->protocol_end(); P != E; ++P)
-        MergeProtocolPropertiesIntoClass(CatDecl, DeclPtrTy::make(*P));
+        CompareProperties(CatDecl, DeclPtrTy::make(*P));
     } else {
       ObjCProtocolDecl *MD = cast<ObjCProtocolDecl>(ClassDecl);
       for (ObjCProtocolDecl::protocol_iterator P = MD->protocol_begin(),
            E = MD->protocol_end(); P != E; ++P)
-        MergeOneProtocolPropertiesIntoClass(CatDecl, *P);
+        MatchOneProtocolPropertiesInClass(CatDecl, *P);
     }
     return;
   }
@@ -510,19 +510,19 @@ void Sema::MergeProtocolPropertiesIntoClass(Decl *CDecl,
   if (ObjCInterfaceDecl *MDecl = dyn_cast<ObjCInterfaceDecl>(ClassDecl)) {
     for (ObjCInterfaceDecl::protocol_iterator P = MDecl->protocol_begin(),
          E = MDecl->protocol_end(); P != E; ++P)
-      // Merge properties of class (*P) into IDECL's
-      MergeOneProtocolPropertiesIntoClass(IDecl, *P);
+      // Match properties of class IDecl with those of protocol (*P).
+      MatchOneProtocolPropertiesInClass(IDecl, *P);
 
-    // Go thru the list of protocols for this class and recursively merge
-    // their properties into this class as well.
+    // Go thru the list of protocols for this class and recursively match
+    // their properties with those declared in the class.
     for (ObjCInterfaceDecl::protocol_iterator P = IDecl->protocol_begin(),
          E = IDecl->protocol_end(); P != E; ++P)
-      MergeProtocolPropertiesIntoClass(IDecl, DeclPtrTy::make(*P));
+      CompareProperties(IDecl, DeclPtrTy::make(*P));
   } else {
     ObjCProtocolDecl *MD = cast<ObjCProtocolDecl>(ClassDecl);
     for (ObjCProtocolDecl::protocol_iterator P = MD->protocol_begin(),
          E = MD->protocol_end(); P != E; ++P)
-      MergeOneProtocolPropertiesIntoClass(IDecl, *P);
+      MatchOneProtocolPropertiesInClass(IDecl, *P);
   }
 }
 
@@ -1086,6 +1086,13 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap,
   }
 }
 
+/// CheckPropertyImplementation - Check that all required properties are
+/// synthesized in class's implementation. This includes properties 
+/// declared in current class and in class's protocols (direct or indirect).
+void Sema::CheckPropertyImplementation(ObjCImplDecl* IMPDecl,
+                                       ObjCInterfaceDecl *CDecl) {
+}
+
 void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl,
                                      ObjCContainerDecl* CDecl,
                                      bool IncompleteImpl) {
@@ -1703,14 +1710,14 @@ void Sema::ActOnAtEnd(SourceRange AtEnd,
     // Compares properties declared in this class to those of its
     // super class.
     ComparePropertiesInBaseAndSuper(I);
-    MergeProtocolPropertiesIntoClass(I, DeclPtrTy::make(I));
+    CompareProperties(I, DeclPtrTy::make(I));
   } else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {
     // Categories are used to extend the class by declaring new methods.
     // By the same token, they are also used to add new properties. No
     // need to compare the added property to those in the class.
 
-    // Merge protocol properties into category
-    MergeProtocolPropertiesIntoClass(C, DeclPtrTy::make(C));
+    // Compare protocol properties with those in category
+    CompareProperties(C, DeclPtrTy::make(C));
     if (C->getIdentifier() == 0)
       DiagnoseClassExtensionDupMethods(C, C->getClassInterface());
   }