Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH.

Makes de-serialization of the function body even more "lazier".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107768 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/AnalysisConsumer.cpp b/lib/Checker/AnalysisConsumer.cpp
index 35f5eec..524f37e 100644
--- a/lib/Checker/AnalysisConsumer.cpp
+++ b/lib/Checker/AnalysisConsumer.cpp
@@ -180,7 +180,7 @@
   }
 
   virtual void HandleTranslationUnit(ASTContext &C);
-  void HandleCode(Decl *D, Stmt* Body, Actions& actions);
+  void HandleCode(Decl *D, Actions& actions);
 };
 } // end anonymous namespace
 
@@ -209,7 +209,7 @@
             FD->getDeclName().getAsString() != Opts.AnalyzeSpecificFunction)
           break;
         DisplayFunction(FD);
-        HandleCode(FD, FD->getBody(), FunctionActions);
+        HandleCode(FD, FunctionActions);
       }
       break;
     }
@@ -222,14 +222,14 @@
             Opts.AnalyzeSpecificFunction != MD->getSelector().getAsString())
           break;
         DisplayFunction(MD);
-        HandleCode(MD, MD->getBody(), ObjCMethodActions);
+        HandleCode(MD, ObjCMethodActions);
       }
       break;
     }
 
     case Decl::ObjCImplementation: {
       ObjCImplementationDecl* ID = cast<ObjCImplementationDecl>(*I);
-      HandleCode(ID, 0, ObjCImplementationActions);
+      HandleCode(ID, ObjCImplementationActions);
 
       for (ObjCImplementationDecl::method_iterator MI = ID->meth_begin(), 
              ME = ID->meth_end(); MI != ME; ++MI) {
@@ -237,7 +237,7 @@
           if (!Opts.AnalyzeSpecificFunction.empty() &&
              Opts.AnalyzeSpecificFunction != (*MI)->getSelector().getAsString())
             break;
-          HandleCode(*MI, (*MI)->getBody(), ObjCMethodActions);
+          HandleCode(*MI, ObjCMethodActions);
         }
       }
       break;
@@ -270,7 +270,7 @@
       FindBlocks(DC, WL);
 }
 
-void AnalysisConsumer::HandleCode(Decl *D, Stmt* Body, Actions& actions) {
+void AnalysisConsumer::HandleCode(Decl *D, Actions& actions) {
 
   // Don't run the actions if an error has occured with parsing the file.
   Diagnostic &Diags = PP.getDiagnostics();
@@ -291,7 +291,7 @@
   llvm::SmallVector<Decl*, 10> WL;
   WL.push_back(D);
 
-  if (Body && Opts.AnalyzeNestedBlocks)
+  if (D->hasBody() && Opts.AnalyzeNestedBlocks)
     FindBlocks(cast<DeclContext>(D), WL);
 
   for (Actions::iterator I = actions.begin(), E = actions.end(); I != E; ++I)