|
68 | 68 | #include "llvm/ADT/IntrusiveRefCntPtr.h"
|
69 | 69 | #include "llvm/ADT/STLExtras.h"
|
70 | 70 | #include "llvm/ADT/ScopeExit.h"
|
71 |
| -#include "llvm/ADT/SmallString.h" |
72 | 71 | #include "llvm/ADT/SmallVector.h"
|
73 | 72 | #include "llvm/ADT/StringMap.h"
|
74 | 73 | #include "llvm/ADT/StringRef.h"
|
|
83 | 82 | #include "llvm/Support/ErrorHandling.h"
|
84 | 83 | #include "llvm/Support/ErrorOr.h"
|
85 | 84 | #include "llvm/Support/FileSystem.h"
|
86 |
| -#include "llvm/Support/FileUtilities.h" |
87 | 85 | #include "llvm/Support/MemoryBuffer.h"
|
88 | 86 | #include "llvm/Support/SaveAndRestore.h"
|
89 | 87 | #include "llvm/Support/Timer.h"
|
@@ -2315,16 +2313,11 @@ bool ASTUnit::Save(StringRef File) {
|
2315 | 2313 | if (HadModuleLoaderFatalFailure)
|
2316 | 2314 | return true;
|
2317 | 2315 |
|
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 += "-%%%%%%%%"; |
2323 | 2316 | // FIXME: Can we somehow regenerate the stat cache here, or do we need to
|
2324 | 2317 | // unconditionally create a stat cache when we parse the file?
|
2325 | 2318 |
|
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) { |
2328 | 2321 | return serialize(Out) ? llvm::make_error<llvm::StringError>(
|
2329 | 2322 | "ASTUnit serialization failed",
|
2330 | 2323 | llvm::inconvertibleErrorCode())
|
|
0 commit comments