Skip to content

Commit 6bda276

Browse files
committed
[LLD][ELF][Windows] small improvement to D82567
Bail early if there is no existing output file to be overwritten. Differential Revision: https://reviews.llvm.org/D83272
1 parent af16a45 commit 6bda276

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎lld/Common/Filesystem.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ using namespace lld;
4040
// This function spawns a background thread to remove the file.
4141
// The calling thread returns almost immediately.
4242
void lld::unlinkAsync(StringRef path) {
43+
if (!sys::fs::exists(path) || !sys::fs::is_regular_file(path))
44+
return;
45+
4346
// Removing a file is async on windows.
4447
#if defined(_WIN32)
4548
// On Windows co-operative programs can be expected to open LLD's
@@ -71,8 +74,7 @@ void lld::unlinkAsync(StringRef path) {
7174
}
7275
sys::fs::remove(path);
7376
#else
74-
if (parallel::strategy.ThreadsRequested == 1 || !sys::fs::exists(path) ||
75-
!sys::fs::is_regular_file(path))
77+
if (parallel::strategy.ThreadsRequested == 1)
7678
return;
7779

7880
// We cannot just remove path from a different thread because we are now going

0 commit comments

Comments
 (0)