[cfe-commits] r42767 - in /cfe/trunk: Sema/Sema.h Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj

Steve Naroff snaroff at apple.com
Mon Oct 8 14:05:34 PDT 2007


Author: snaroff
Date: Mon Oct  8 16:05:34 2007
New Revision: 42767

URL: http://llvm.org/viewvc/llvm-project?rev=42767&view=rev
Log:

Convert Selector Maps/Sets to use stronger typing (now that we have DenseMapInfo in IdentifierTable.h).


Modified:
    cfe/trunk/Sema/Sema.h
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj

Modified: cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.h?rev=42767&r1=42766&r2=42767&view=diff

==============================================================================
--- cfe/trunk/Sema/Sema.h (original)
+++ cfe/trunk/Sema/Sema.h Mon Oct  8 16:05:34 2007
@@ -220,7 +220,7 @@
   /// Declared in protocol, and those referenced by it.
   void CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl,
                                bool& IncompleteImpl,
-                               const llvm::DenseSet<void *>& InsMap,
+                               const llvm::DenseSet<Selector> &InsMap,
                                const llvm::DenseSet<Selector> &ClsMap);
   
   /// CheckImplementationIvars - This routine checks if the instance variables

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=42767&r1=42766&r2=42767&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Mon Oct  8 16:05:34 2007
@@ -1240,13 +1240,12 @@
 /// Declared in protocol, and those referenced by it.
 void Sema::CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl,
                                    bool& IncompleteImpl,
-             const llvm::DenseSet<void *>& InsMap,
+             const llvm::DenseSet<Selector> &InsMap,
              const llvm::DenseSet<Selector> &ClsMap) {
   // check unimplemented instance methods.
   ObjcMethodDecl** methods = PDecl->getInstanceMethods();
   for (int j = 0; j < PDecl->getNumInstanceMethods(); j++) {
-    void * cpv = methods[j]->getSelector().getAsOpaquePtr();
-    if (!InsMap.count(cpv)) {
+    if (!InsMap.count(methods[j]->getSelector())) {
       Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
            methods[j]->getSelector().getName());
       IncompleteImpl = true;
@@ -1269,17 +1268,17 @@
 
 void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, 
                                      ObjcInterfaceDecl* IDecl) {
-  llvm::DenseSet<void *> InsMap;
+  llvm::DenseSet<Selector> InsMap;
   // Check and see if instance methods in class interface have been
   // implemented in the implementation class.
   ObjcMethodDecl **methods = IMPDecl->getInstanceMethods();
   for (int i=0; i < IMPDecl->getNumInstanceMethods(); i++) 
-    InsMap.insert(methods[i]->getSelector().getAsOpaquePtr());
+    InsMap.insert(methods[i]->getSelector());
   
   bool IncompleteImpl = false;
   methods = IDecl->getInstanceMethods();
   for (int j = 0; j < IDecl->getNumInstanceMethods(); j++)
-    if (!InsMap.count(methods[j]->getSelector().getAsOpaquePtr())) {
+    if (!InsMap.count(methods[j]->getSelector())) {
       Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
            methods[j]->getSelector().getName());
       IncompleteImpl = true;
@@ -1314,17 +1313,17 @@
 /// category interface is implemented in the category @implementation.
 void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl,
                                             ObjcCategoryDecl *CatClassDecl) {
-  llvm::DenseSet<void *> InsMap;
+  llvm::DenseSet<Selector> InsMap;
   // Check and see if instance methods in category interface have been
   // implemented in its implementation class.
   ObjcMethodDecl **methods = CatImplDecl->getInstanceMethods();
   for (int i=0; i < CatImplDecl->getNumInstanceMethods(); i++)
-    InsMap.insert(methods[i]->getSelector().getAsOpaquePtr());
+    InsMap.insert(methods[i]->getSelector());
   
   bool IncompleteImpl = false;
   methods = CatClassDecl->getInstanceMethods();
   for (int j = 0; j < CatClassDecl->getNumInstanceMethods(); j++)
-    if (!InsMap.count(methods[j]->getSelector().getAsOpaquePtr())) {
+    if (!InsMap.count(methods[j]->getSelector())) {
       Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
            methods[j]->getSelector().getName());
       IncompleteImpl = true;
@@ -1725,8 +1724,8 @@
   llvm::SmallVector<ObjcMethodDecl*, 32> insMethods;
   llvm::SmallVector<ObjcMethodDecl*, 16> clsMethods;
   
-  llvm::DenseMap<void *, const ObjcMethodDecl*> InsMap;
-  llvm::DenseMap<void *, const ObjcMethodDecl*> ClsMap;
+  llvm::DenseMap<Selector, const ObjcMethodDecl*> InsMap;
+  llvm::DenseMap<Selector, const ObjcMethodDecl*> ClsMap;
   
   bool isClassDeclaration = 
         (isa<ObjcInterfaceDecl>(ClassDecl) || isa<ObjcCategoryDecl>(ClassDecl));
@@ -1738,8 +1737,7 @@
     if (Method->isInstance()) {
       if (isClassDeclaration) {
         /// Check for instance method of the same name with incompatible types
-        const ObjcMethodDecl *&PrevMethod = 
-                InsMap[Method->getSelector().getAsOpaquePtr()];
+        const ObjcMethodDecl *&PrevMethod = InsMap[Method->getSelector()];
         if (PrevMethod && !MatchTwoMethodDeclarations(Method, PrevMethod)) {
           Diag(Method->getLocation(), diag::error_duplicate_method_decl,
                Method->getSelector().getName());
@@ -1747,7 +1745,7 @@
         }
         else {
           insMethods.push_back(Method);
-          InsMap[Method->getSelector().getAsOpaquePtr()] = Method;
+          InsMap[Method->getSelector()] = Method;
         }
       }
       else
@@ -1756,8 +1754,7 @@
     else {
       if (isClassDeclaration) {
         /// Check for class method of the same name with incompatible types
-        const ObjcMethodDecl *&PrevMethod = 
-                ClsMap[Method->getSelector().getAsOpaquePtr()];
+        const ObjcMethodDecl *&PrevMethod = ClsMap[Method->getSelector()];
         if (PrevMethod && !MatchTwoMethodDeclarations(Method, PrevMethod)) {
           Diag(Method->getLocation(), diag::error_duplicate_method_decl,
                Method->getSelector().getName());
@@ -1765,7 +1762,7 @@
         }
         else {        
           clsMethods.push_back(Method);
-          ClsMap[Method->getSelector().getAsOpaquePtr()] = Method;
+          ClsMap[Method->getSelector()] = Method;
         }
       }
       else

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=42767&r1=42766&r2=42767&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Mon Oct  8 16:05:34 2007
@@ -237,7 +237,7 @@
 		84AF36A00CB17A3B00C820A5 /* DeclObjC.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DeclObjC.h; path = clang/AST/DeclObjC.h; sourceTree = "<group>"; };
 		84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AttributeList.cpp; path = Parse/AttributeList.cpp; sourceTree = "<group>"; };
 		84D9A88B0C1A581300AC7ABC /* AttributeList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AttributeList.h; path = clang/Parse/AttributeList.h; sourceTree = "<group>"; };
-		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
+		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
 		DE01DA480B12ADA300AC22CE /* PPCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PPCallbacks.h; sourceTree = "<group>"; };
 		DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ParseExprCXX.cpp; path = Parse/ParseExprCXX.cpp; sourceTree = "<group>"; };
 		DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; };
@@ -739,7 +739,6 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
-			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 1;
 			mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
 			projectDirPath = "";





More information about the cfe-commits mailing list