Add new check: -check-objc-methodsigs. This check scans methods in
ObjCImplementationDecls and sees if a ancestor class defines a method with the
same selector but with a different type signature. Right now it just compares
return types, and mainly looks at differences in primitive values. The checking
will be expanded in the future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53482 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp
index 44d96a0..28ebe1d 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -390,6 +390,13 @@
                    mgr.getLangOptions(), BR);  
 }
 
+static void ActionCheckObjCInstMethSignature(AnalysisManager& mgr) {
+  BugReporter BR(mgr);
+  
+  CheckObjCInstMethSignature(cast<ObjCImplementationDecl>(mgr.getCodeDecl()),
+                             BR);
+}
+
 //===----------------------------------------------------------------------===//
 // AnalysisConsumer creation.
 //===----------------------------------------------------------------------===//
@@ -416,6 +423,10 @@
       case WarnUninitVals:
         C->addCodeAction(&ActionUninitVals);
         break;
+        
+      case CheckObjCMethSigs:
+        C->addObjCImplementationAction(&ActionCheckObjCInstMethSignature);
+        break;
       
       case DisplayLiveVariables:
         C->addCodeAction(&ActionLiveness);
@@ -442,8 +453,8 @@
   
   // Checks we always perform:
   if (lopts.getGCMode() != LangOptions::GCOnly)
-    C->addObjCImplementationAction(&ActionCheckObjCDealloc);  
-  
+    C->addObjCImplementationAction(&ActionCheckObjCDealloc);
+    
   return C.take();
 }