[cfe-commits] r48424 - /cfe/trunk/include/clang/AST/DeclObjC.h

Chris Lattner sabre at nondot.org
Sun Mar 16 13:22:07 PDT 2008


Author: lattner
Date: Sun Mar 16 15:22:07 2008
New Revision: 48424

URL: http://llvm.org/viewvc/llvm-project?rev=48424&view=rev
Log:
make NumClassMethods unsigned in categories

Modified:
    cfe/trunk/include/clang/AST/DeclObjC.h

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=48424&r1=48423&r2=48424&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sun Mar 16 15:22:07 2008
@@ -618,7 +618,7 @@
 
   /// category class methods
   ObjCMethodDecl **ClassMethods;  // Null if not defined
-  int NumClassMethods;  // -1 if not defined
+  unsigned NumClassMethods;  // 0 if not defined
   
   /// Next category belonging to this class
   ObjCCategoryDecl *NextClassCategory;
@@ -630,15 +630,15 @@
     : NamedDecl(ObjCCategory, L, Id),
       ClassInterface(0), ReferencedProtocols(0), NumReferencedProtocols(0),
       InstanceMethods(0), NumInstanceMethods(0),
-      ClassMethods(0), NumClassMethods(-1),
+      ClassMethods(0), NumClassMethods(0),
       NextClassCategory(0) {
-        if (numRefProtocol) {
-          ReferencedProtocols = new ObjCProtocolDecl*[numRefProtocol];
-          memset(ReferencedProtocols, '\0', 
-                 numRefProtocol*sizeof(ObjCProtocolDecl*));
-          NumReferencedProtocols = numRefProtocol;
-        }
-      }
+    if (numRefProtocol) {
+      ReferencedProtocols = new ObjCProtocolDecl*[numRefProtocol];
+      memset(ReferencedProtocols, '\0', 
+             numRefProtocol*sizeof(ObjCProtocolDecl*));
+      NumReferencedProtocols = numRefProtocol;
+    }
+  }
 
   ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
   void setClassInterface(ObjCInterfaceDecl *IDecl) { ClassInterface = IDecl; }
@@ -653,7 +653,7 @@
   }
   unsigned getNumReferencedProtocols() const { return NumReferencedProtocols; }
   unsigned getNumInstanceMethods() const { return NumInstanceMethods; }
-  int getNumClassMethods() const { return NumClassMethods; }
+  unsigned getNumClassMethods() const { return NumClassMethods; }
 
   typedef ObjCMethodDecl * const * instmeth_iterator;
   instmeth_iterator instmeth_begin() const { return InstanceMethods; }
@@ -664,11 +664,11 @@
   typedef ObjCMethodDecl * const * classmeth_iterator;
   classmeth_iterator classmeth_begin() const { return ClassMethods; }
   classmeth_iterator classmeth_end() const {
-    return ClassMethods+(NumClassMethods == -1 ? 0 : NumClassMethods);
+    return ClassMethods+NumClassMethods;
   }
 
   // Get the local instance method declared in this interface.
-  ObjCMethodDecl *getInstanceMethod(Selector &Sel) {
+  ObjCMethodDecl *getInstanceMethod(const Selector &Sel) {
     for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); 
              I != E; ++I) {
       if ((*I)->getSelector() == Sel)
@@ -677,7 +677,7 @@
         return 0;
   }
   // Get the local class method declared in this interface.
-  ObjCMethodDecl *getClassMethod(Selector &Sel) {
+  ObjCMethodDecl *getClassMethod(const Selector &Sel) {
     for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); 
              I != E; ++I) {
       if ((*I)->getSelector() == Sel)





More information about the cfe-commits mailing list