[clang] 3a9ea6a - [clang] NFC, replace llvm::writeFileAtomically with llvm::writeToOutput API inGlobalModuleIndex.cpp

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 01:31:08 PDT 2023


Author: Haojian Wu
Date: 2023-06-30T10:30:54+02:00
New Revision: 3a9ea6a48a7092b89515f4c3e2b2b6d5851b2b61

URL: https://github.com/llvm/llvm-project/commit/3a9ea6a48a7092b89515f4c3e2b2b6d5851b2b61
DIFF: https://github.com/llvm/llvm-project/commit/3a9ea6a48a7092b89515f4c3e2b2b6d5851b2b61.diff

LOG: [clang] NFC, replace llvm::writeFileAtomically with llvm::writeToOutput API inGlobalModuleIndex.cpp

We're in favor of writeToOutput.

Added: 
    

Modified: 
    clang/lib/Serialization/GlobalModuleIndex.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 1b8c1303a2886..d57f4cec2eab6 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -25,12 +25,12 @@
 #include "llvm/Bitstream/BitstreamWriter.h"
 #include "llvm/Support/DJB.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/LockFileManager.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/OnDiskHashTable.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TimeProfiler.h"
+#include "llvm/Support/raw_ostream.h"
 #include <cstdio>
 using namespace clang;
 using namespace serialization;
@@ -907,8 +907,10 @@ GlobalModuleIndex::writeIndex(FileManager &FileMgr,
                                      "failed writing index");
   }
 
-  return llvm::writeFileAtomically((IndexPath + "-%%%%%%%%").str(), IndexPath,
-                                   OutputBuffer);
+  return llvm::writeToOutput(IndexPath, [&OutputBuffer](llvm::raw_ostream &OS) {
+    OS << OutputBuffer;
+    return llvm::Error::success();
+  });
 }
 
 namespace {


        


More information about the cfe-commits mailing list