summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/Caching.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-09-07 00:55:00 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-09-07 00:55:00 +0000
commit264d7c9021edd1d527567c105cc0285194f4d3bc (patch)
tree30fe54c61cd0eda9fe8876e316d9e5bd575694a4 /llvm/lib/LTO/Caching.cpp
parent3310888aec6630f69963f4484e1db9d3540f449a (diff)
downloadbcm5719-llvm-264d7c9021edd1d527567c105cc0285194f4d3bc.tar.gz
bcm5719-llvm-264d7c9021edd1d527567c105cc0285194f4d3bc.zip
LTO: Remove unnecessary Windows support code.
I empirically verified that open files can in fact be renamed on Windows with sys::fs::rename, so remove the incorrect code and comment. llvm-svn: 312683
Diffstat (limited to 'llvm/lib/LTO/Caching.cpp')
-rw-r--r--llvm/lib/LTO/Caching.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/llvm/lib/LTO/Caching.cpp b/llvm/lib/LTO/Caching.cpp
index 3f10c154683..98360f7e9e9 100644
--- a/llvm/lib/LTO/Caching.cpp
+++ b/llvm/lib/LTO/Caching.cpp
@@ -63,20 +63,6 @@ Expected<NativeObjectCache> lto::localCache(StringRef CacheDirectoryPath,
// Make sure the file is closed before committing it.
OS.reset();
-#ifdef _WIN32
- // Rename the file first on Windows because we cannot rename an open
- // file on that platform using the sys::fs::rename function.
- // FIXME: This code could race with the cache pruner, but it is unlikely
- // that the cache pruner will choose to remove a newly created file.
- // We should look at using the SetFileInformationByHandle function to
- // rename the file while it is open.
- if (auto EC = sys::fs::rename(TempFilename, EntryPath))
- report_fatal_error(Twine("Failed to rename temporary file ") +
- TempFilename + ": " + EC.message() + "\n");
-
- ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =
- MemoryBuffer::getFile(EntryPath);
-#else
// Open the file first to avoid racing with a cache pruner.
ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =
MemoryBuffer::getFile(TempFilename);
@@ -85,7 +71,6 @@ Expected<NativeObjectCache> lto::localCache(StringRef CacheDirectoryPath,
if (auto EC = sys::fs::rename(TempFilename, EntryPath))
report_fatal_error(Twine("Failed to rename temporary file ") +
TempFilename + ": " + EC.message() + "\n");
-#endif
if (!MBOrErr)
report_fatal_error(Twine("Failed to open cache file ") + EntryPath +
OpenPOWER on IntegriCloud