Switch some utilities in clang-cc to take a stream instead of a 
filename (or unconditionally using stdout).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72085 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/CacheTokens.cpp b/tools/clang-cc/CacheTokens.cpp
index d9827df..5335236 100644
--- a/tools/clang-cc/CacheTokens.cpp
+++ b/tools/clang-cc/CacheTokens.cpp
@@ -535,16 +535,7 @@
 } // end anonymous namespace
 
 
-void clang::CacheTokens(Preprocessor &PP, const std::string &OutFile) {
-  // Open up the PTH file.
-  std::string ErrMsg;
-  llvm::raw_fd_ostream Out(OutFile.c_str(), true, ErrMsg);
-  
-  if (!ErrMsg.empty()) {
-    llvm::errs() << "PTH error: " << ErrMsg << "\n";
-    return;
-  }
-  
+void clang::CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS) {
   // Get the name of the main file.
   const SourceManager &SrcMgr = PP.getSourceManager();
   const FileEntry *MainFile = SrcMgr.getFileEntryForID(SrcMgr.getMainFileID());
@@ -560,7 +551,7 @@
   }
 
   // Create the PTHWriter.
-  PTHWriter PW(Out, PP);
+  PTHWriter PW(*OS, PP);
   
   // Install the 'stat' system call listener in the FileManager.
   PP.getFileManager().setStatCache(new StatListener(PW.getPM()));