minor cleanups to ast-dump, use getBody(context).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70095 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/ASTConsumers.cpp b/tools/clang-cc/ASTConsumers.cpp
index 7595c2a..9e2d9e3 100644
--- a/tools/clang-cc/ASTConsumers.cpp
+++ b/tools/clang-cc/ASTConsumers.cpp
@@ -590,12 +590,12 @@
 
 namespace {
   class ASTDumper : public ASTConsumer, public DeclPrinter {
-    SourceManager *SM;
+    ASTContext *Ctx;
   public:
     ASTDumper() : DeclPrinter() {}
     
     void Initialize(ASTContext &Context) {
-      SM = &Context.getSourceManager();
+      Ctx = &Context;
     }
 
     virtual void HandleTopLevelDecl(DeclGroupRef D) {
@@ -610,10 +610,10 @@
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     PrintFunctionDeclStart(FD);
     
-    if (FD->getBodyIfAvailable()) {
+    if (Stmt *Body = FD->getBody(*Ctx)) {
       Out << '\n';
-      // FIXME: convert dumper to use std::ostream?
-      FD->getBodyIfAvailable()->dumpAll(*SM);
+      // FIXME: convert dumper to use raw_ostream.
+      Body->dumpAll(Ctx->getSourceManager());
       Out << '\n';
     }
   } else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
@@ -633,9 +633,9 @@
   } else if (ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(D)) {
     Out << "Read objc method decl: '" << MD->getSelector().getAsString()
     << "'\n";
-    if (MD->getBody()) {
-      // FIXME: convert dumper to use std::ostream?
-      MD->getBody()->dumpAll(*SM);
+    if (Stmt *S = MD->getBody()) {
+      // FIXME: convert dumper to use raw_ostream.
+      S->dumpAll(Ctx->getSourceManager());
       Out << '\n';
     }
   } else if (isa<ObjCImplementationDecl>(D)) {