Add prototype implementation of unused ivar check.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53942 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/Analyses.def b/Driver/Analyses.def
index 623a247..841f0c1 100644
--- a/Driver/Analyses.def
+++ b/Driver/Analyses.def
@@ -33,6 +33,9 @@
 ANALYSIS(WarnObjCDealloc, "warn-objc-missing-dealloc",
  "Warn about Objective-C classes that lack a correct implementation of -dealloc",
  ObjCImplementation)
+ 
+ANALYSIS(WarnObjCUnusedIvars, "warn-objc-unused-ivars",
+  "Warn about private ivars that are never used", ObjCImplementation)
 
 ANALYSIS(CheckerSimple, "checker-simple",
          "Perform simple path-sensitive checks.", Code)
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp
index deb7a85..134f6d6 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -393,6 +393,11 @@
                    mgr.getLangOptions(), BR);  
 }
 
+static void ActionWarnObjCUnusedIvars(AnalysisManager& mgr) {
+  BugReporter BR(mgr);
+  CheckObjCUnusedIvar(cast<ObjCImplementationDecl>(mgr.getCodeDecl()), BR);  
+}
+
 static void ActionWarnObjCMethSigs(AnalysisManager& mgr) {
   BugReporter BR(mgr);