diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2012-03-03 00:36:06 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2012-03-03 00:36:06 +0000 |
| commit | ae77b3dfad40906145df98c256bf91ee30ee1852 (patch) | |
| tree | 4b8ebb90524b3e722746ba6c8ee683faf3c794e0 /clang | |
| parent | b9c62c0773757562b1abed808c5441e52fc0b77c (diff) | |
| download | bcm5719-llvm-ae77b3dfad40906145df98c256bf91ee30ee1852.tar.gz bcm5719-llvm-ae77b3dfad40906145df98c256bf91ee30ee1852.zip | |
Frontend: Default to creating output files using temporary files + rename.
- This is a more reliable default, as it behaves better on failure and also
ensures that we create *new* files (instead of reusing existing inodes). This
is useful for other applications (like lldb) which want to cache inode's to
know when a file has been rewritten.
llvm-svn: 151961
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 4 | ||||
| -rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index 4ee90dfb9cd..ff0c30939a4 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -572,6 +572,10 @@ public: /// Create the default output file (from the invocation's options) and add it /// to the list of tracked output files. /// + /// The files created by this function always use temporary files to write to + /// their result (that is, the data is written to a temporary file which will + /// atomically replace the target output on success). + /// /// \return - Null on error. llvm::raw_fd_ostream * createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "", diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index a7855112e65..bf3e3a8908d 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -470,7 +470,8 @@ CompilerInstance::createDefaultOutputFile(bool Binary, StringRef InFile, StringRef Extension) { return createOutputFile(getFrontendOpts().OutputFile, Binary, - /*RemoveFileOnSignal=*/true, InFile, Extension); + /*RemoveFileOnSignal=*/true, InFile, Extension, + /*UseTemporary=*/true); } llvm::raw_fd_ostream * |

