Skip to content

Commit db15ace

Browse files
committed
[clang] NFC, replace llvm::writeFileAtomically with llvm::writeToOutput
API in ASTUnit.cpp writeFileAtomically is going to be deprecated, in favor of writeToOutput.
1 parent 8ed172c commit db15ace

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

clang/lib/Frontend/ASTUnit.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
#include "llvm/ADT/IntrusiveRefCntPtr.h"
6969
#include "llvm/ADT/STLExtras.h"
7070
#include "llvm/ADT/ScopeExit.h"
71-
#include "llvm/ADT/SmallString.h"
7271
#include "llvm/ADT/SmallVector.h"
7372
#include "llvm/ADT/StringMap.h"
7473
#include "llvm/ADT/StringRef.h"
@@ -83,7 +82,6 @@
8382
#include "llvm/Support/ErrorHandling.h"
8483
#include "llvm/Support/ErrorOr.h"
8584
#include "llvm/Support/FileSystem.h"
86-
#include "llvm/Support/FileUtilities.h"
8785
#include "llvm/Support/MemoryBuffer.h"
8886
#include "llvm/Support/SaveAndRestore.h"
8987
#include "llvm/Support/Timer.h"
@@ -2315,16 +2313,11 @@ bool ASTUnit::Save(StringRef File) {
23152313
if (HadModuleLoaderFatalFailure)
23162314
return true;
23172315

2318-
// Write to a temporary file and later rename it to the actual file, to avoid
2319-
// possible race conditions.
2320-
SmallString<128> TempPath;
2321-
TempPath = File;
2322-
TempPath += "-%%%%%%%%";
23232316
// FIXME: Can we somehow regenerate the stat cache here, or do we need to
23242317
// unconditionally create a stat cache when we parse the file?
23252318

2326-
if (llvm::Error Err = llvm::writeFileAtomically(
2327-
TempPath, File, [this](llvm::raw_ostream &Out) {
2319+
if (llvm::Error Err = llvm::writeToOutput(
2320+
File, [this](llvm::raw_ostream &Out) {
23282321
return serialize(Out) ? llvm::make_error<llvm::StringError>(
23292322
"ASTUnit serialization failed",
23302323
llvm::inconvertibleErrorCode())

0 commit comments

Comments
 (0)