[clangd] Replace writeFileAtomically with writeToOutput, NFC
authorHaojian Wu <hokein.wu@gmail.com>
Fri, 30 Jun 2023 07:52:24 +0000 (09:52 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Fri, 30 Jun 2023 08:02:42 +0000 (10:02 +0200)
We're going to deprecate the writeFileAtomically API, in favour of
writeToOutput.

clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp

index 963e221..e32ddd0 100644 (file)
@@ -14,9 +14,9 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/raw_ostream.h"
 #include <functional>
 #include <optional>
 
@@ -67,11 +67,10 @@ public:
   llvm::Error storeShard(llvm::StringRef ShardIdentifier,
                          IndexFileOut Shard) const override {
     auto ShardPath = getShardPathFromFilePath(DiskShardRoot, ShardIdentifier);
-    return llvm::writeFileAtomically(ShardPath + ".tmp.%%%%%%%%", ShardPath,
-                                     [&Shard](llvm::raw_ostream &OS) {
-                                       OS << Shard;
-                                       return llvm::Error::success();
-                                     });
+    return llvm::writeToOutput(ShardPath, [&Shard](llvm::raw_ostream &OS) {
+      OS << Shard;
+      return llvm::Error::success();
+    });
   }
 };