[clang-tools-extra] 2feac34 - [clangd] Replace writeFileAtomically with writeToOutput, NFC

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


Author: Haojian Wu
Date: 2023-06-30T10:02:42+02:00
New Revision: 2feac34aeeaf67943492a5adfe45c3f4767bdfe4

URL: https://github.com/llvm/llvm-project/commit/2feac34aeeaf67943492a5adfe45c3f4767bdfe4
DIFF: https://github.com/llvm/llvm-project/commit/2feac34aeeaf67943492a5adfe45c3f4767bdfe4.diff

LOG: [clangd] Replace writeFileAtomically with writeToOutput, NFC

We're going to deprecate the writeFileAtomically API, in favour of
writeToOutput.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
index 963e221be83a32..e32ddd052e4188 100644
--- a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
+++ b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
@@ -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 @@ class DiskBackedIndexStorage : public BackgroundIndexStorage {
   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();
+    });
   }
 };
 


        


More information about the cfe-commits mailing list