FunctionDecl::getBody() is getting an ASTContext argument for use in
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/ASTConsumers.cpp b/tools/clang-cc/ASTConsumers.cpp
index 61a9e44..aabbf2a 100644
--- a/tools/clang-cc/ASTConsumers.cpp
+++ b/tools/clang-cc/ASTConsumers.cpp
@@ -80,9 +80,10 @@
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     PrintFunctionDeclStart(FD);
 
-    if (FD->getBody()) {
+    // FIXME: Pass a context here so we can use getBody()
+    if (FD->getBodyIfAvailable()) {
       Out << ' ';
-      FD->getBody()->printPretty(Out, 0, Indentation, true);
+      FD->getBodyIfAvailable()->printPretty(Out, 0, Indentation, true);
       Out << '\n';
     }
   } else if (isa<ObjCMethodDecl>(D)) {
@@ -221,7 +222,8 @@
 }
 
 void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) {
-  bool HasBody = FD->getBody();
+  // FIXME: pass a context so that we can use getBody.
+  bool HasBody = FD->getBodyIfAvailable();
   
   Out << '\n';
 
@@ -264,7 +266,7 @@
   AFT->getResultType().getAsStringInternal(Proto);
   Out << Proto;
   
-  if (!FD->getBody())
+  if (!FD->getBodyIfAvailable())
     Out << ";\n";
   // Doesn't print the body.
 }
@@ -596,10 +598,10 @@
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     PrintFunctionDeclStart(FD);
     
-    if (FD->getBody()) {
+    if (FD->getBodyIfAvailable()) {
       Out << '\n';
       // FIXME: convert dumper to use std::ostream?
-      FD->getBody()->dumpAll(*SM);
+      FD->getBodyIfAvailable()->dumpAll(*SM);
       Out << '\n';
     }
   } else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
@@ -664,9 +666,9 @@
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     DeclPrinter().PrintFunctionDeclStart(FD);
     
-    if (FD->getBody()) {
+    if (FD->getBodyIfAvailable()) {
       llvm::cerr << '\n';
-      FD->getBody()->viewAST();
+      FD->getBodyIfAvailable()->viewAST();
       llvm::cerr << '\n';
     }
     return;