clang/lib/Rewrite/Rewriter.cpp: Don't try to rename opened files on Win32. Win32 doesn't allow rename/removing opened files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157528 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/Rewriter.cpp b/lib/Rewrite/Rewriter.cpp
index a2d03a1..f7b0154 100644
--- a/lib/Rewrite/Rewriter.cpp
+++ b/lib/Rewrite/Rewriter.cpp
@@ -444,6 +444,10 @@
     if (!ok()) return;
 
     FileStream->flush();
+#ifdef _WIN32
+    // Win32 does not allow rename/removing opened files.
+    FileStream.reset();
+#endif
     if (llvm::error_code ec =
           llvm::sys::fs::rename(TempFilename.str(), Filename)) {
       AllWritten = false;