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/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 06f38e8..853f7c3 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1181,7 +1181,7 @@
         D->isThisDeclarationADefinition()) {
       // Check for a function body.
       const FunctionDecl *Definition = 0;
-      if (Function->getBody(Definition) &&
+      if (Function->hasBody(Definition) &&
           Definition->getTemplateSpecializationKind() == TSK_Undeclared) {
         SemaRef.Diag(Function->getLocation(), diag::err_redefinition) 
           << Function->getDeclName();
@@ -1197,7 +1197,7 @@
             ((*R)->getFriendObjectKind() != Decl::FOK_None)) {
           if (const FunctionDecl *RPattern
               = (*R)->getTemplateInstantiationPattern())
-            if (RPattern->getBody(RPattern)) {
+            if (RPattern->hasBody(RPattern)) {
               SemaRef.Diag(Function->getLocation(), diag::err_redefinition) 
                 << Function->getDeclName();
               SemaRef.Diag((*R)->getLocation(), diag::note_previous_definition);
@@ -2040,7 +2040,7 @@
                                          FunctionDecl *Function,
                                          bool Recursive,
                                          bool DefinitionRequired) {
-  if (Function->isInvalidDecl() || Function->getBody())
+  if (Function->isInvalidDecl() || Function->hasBody())
     return;
 
   // Never instantiate an explicit specialization.