Fix ownership model of ParseAST to allow the dtor of 
ASTConsumer to process the AST before it is destroyed.
This allows elimination of HandleObjcMetaDataEmission.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43659 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index ca9b115..7bbd7af 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -79,7 +79,6 @@
     void SynthGetClassFunctionDecl();
     
     // Metadata emission.
-    void HandleObjcMetaDataEmission();
     void RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl,
                                   std::string &Result);
     
@@ -162,6 +161,12 @@
   // Get the top-level buffer that this corresponds to.
   RewriteTabs();
   
+  // Rewrite Objective-c meta data*
+  std::string ResultStr;
+  WriteObjcMetaData(ResultStr);
+  // For now just print the string out.
+  printf("%s", ResultStr.c_str());
+  
   // Get the buffer corresponding to MainFileID.  If we haven't changed it, then
   // we are done.
   if (const RewriteBuffer *RewriteBuf = 
@@ -175,16 +180,6 @@
 
 }
 
-/// HandleObjcMetaDataEmission - main routine to generate objective-c's 
-/// metadata.
-void RewriteTest::HandleObjcMetaDataEmission() {
-  // Rewrite Objective-c meta data*
-  std::string ResultStr;
-  WriteObjcMetaData(ResultStr);
-  // For now just print the string out.
-  printf("%s", ResultStr.c_str());
-}
-
 //===----------------------------------------------------------------------===//
 // Syntactic (non-AST) Rewriting Code
 //===----------------------------------------------------------------------===//