clang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...) instead.

FIXME: PathV2::unique_file() is assumed to open the file with binary mode on win32.
llvm-svn: 173330
diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 3b60979..1600e35 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -507,9 +507,7 @@
     return EC_IOError;
 
   // Open the temporary global index file for output.
-  std::string ErrorInfo;
-  llvm::raw_fd_ostream Out(IndexTmpPath.c_str(), ErrorInfo,
-                           llvm::raw_fd_ostream::F_Binary);
+  llvm::raw_fd_ostream Out(TmpFD, true);
   if (Out.has_error())
     return EC_IOError;