From: Fariborz Jahanian Date: Mon, 18 Jan 2010 18:41:16 +0000 (+0000) Subject: Mostly renaming some methods and updating comments to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=107089f36de33b03f411ace7b9352606a69bc3af;p=clang Mostly renaming some methods and updating comments to 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 --- diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 02e3a7a93d..b273feb5b2 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -1278,6 +1278,9 @@ public: const llvm::DenseSet &InsMap, const llvm::DenseSet &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, diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index ba21df776e..c0cbc416d9 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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(CDecl); if (!IDecl) { // Category ObjCCategoryDecl *CatDecl = static_cast(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(); +void Sema::CompareProperties(Decl *CDecl, + DeclPtrTy ClassOrProtocol) { + Decl *ClassDecl = ClassOrProtocol.getAs(); ObjCInterfaceDecl *IDecl = dyn_cast_or_null(CDecl); if (!IDecl) { // Category ObjCCategoryDecl *CatDecl = static_cast(CDecl); - assert (CatDecl && "MergeProtocolPropertiesIntoClass"); + assert (CatDecl && "CompareProperties"); if (ObjCCategoryDecl *MDecl = dyn_cast(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(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(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(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 &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(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()); }