Page MenuHomePhabricator

[LLD][ELF][Windows] small improvement to D82567
ClosedPublic

Authored by bd1976llvm on Jul 6 2020, 6:10 PM.

Details

Summary

Bail early if there is no existing output file to be overwritten.

Diff Detail

Event Timeline

bd1976llvm created this revision.Jul 6 2020, 6:10 PM
grimar added inline comments.Jul 7 2020, 3:08 AM
lld/Common/Filesystem.cpp
69

Should it be at the begining of the method to be shared with !_WIN32?

I see it has this in the condition below:

if (parallel::strategy.ThreadsRequested == 1 || !sys::fs::exists(path) ||
    !sys::fs::is_regular_file(path))
  return;
bd1976llvm updated this revision to Diff 276037.Jul 7 2020, 6:29 AM
bd1976llvm marked 2 inline comments as done.

Share logic between the two code paths.

bd1976llvm added a comment.EditedJul 7 2020, 6:30 AM

BTW - I realised that this function needs formatting correctly :(

*Update*: I was wrong, the formatting is fine - sorry for the noise!

lld/Common/Filesystem.cpp
69

Yes. We can share these conditions between the two paths.

grimar added inline comments.Jul 7 2020, 6:38 AM
lld/Common/Filesystem.cpp
43

This empty line is probably excessive.

47

I think you can leave this condition at its original place. I am not sure what was the reason
to move it here (it is not a shared piece anyways)?

bd1976llvm marked 3 inline comments as done.Jul 7 2020, 6:48 AM
bd1976llvm added inline comments.
lld/Common/Filesystem.cpp
47

Sorry. Premature optimisation.

bd1976llvm updated this revision to Diff 276042.Jul 7 2020, 6:48 AM
bd1976llvm marked an inline comment as done.

Addressed review comments.

grimar accepted this revision.Jul 7 2020, 6:49 AM

LGTM!

This revision is now accepted and ready to land.Jul 7 2020, 6:49 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2020, 4:02 AM