minor cleanups, make getNumInstanceMethods always return unsigned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48423 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index d72aaf2..7bdec93 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -2348,9 +2348,7 @@
     for (int i = 0; i < NumProtocols; i++) {
       ObjCProtocolDecl *PDecl = Protocols[i];
       // Output struct protocol_methods holder of method selector and type.
-      if (!objc_protocol_methods &&
-          (PDecl->getNumInstanceMethods() > 0 
-           || PDecl->getNumClassMethods() > 0)) {
+      if (!objc_protocol_methods && !PDecl->isForwardDecl()) {
         /* struct protocol_methods {
          SEL _cmd;
          char *method_types;
@@ -2363,8 +2361,8 @@
         
         objc_protocol_methods = true;
       }
-      int NumMethods = PDecl->getNumInstanceMethods();
-      if(NumMethods > 0) {
+      if (PDecl->instmeth_begin() != PDecl->instmeth_end()) {
+        unsigned NumMethods = PDecl->getNumInstanceMethods();
         /* struct _objc_protocol_method_list {
          int protocol_method_count;
          struct protocol_methods protocols[];
@@ -2397,7 +2395,7 @@
       }
       
       // Output class methods declared in this protocol.
-      NumMethods = PDecl->getNumClassMethods();
+      int NumMethods = PDecl->getNumClassMethods();
       if (NumMethods > 0) {
         /* struct _objc_protocol_method_list {
          int protocol_method_count;
@@ -2460,7 +2458,7 @@
         "{\n\t0, \"";
       Result += PDecl->getName();
       Result += "\", 0, ";
-      if (PDecl->getNumInstanceMethods() > 0) {
+      if (PDecl->instmeth_begin() != PDecl->instmeth_end()) {
         Result += "(struct _objc_protocol_method_list *)&_OBJC_PROTOCOL_INSTANCE_METHODS_";
         Result += PDecl->getName();
         Result += ", ";