[lld] r317536 - Use Path instead of Config->OutputFile. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 18:04:36 PST 2017


Thanks. The original code should be considered as having a bug even if it
didn't cause any issue.

On Mon, Nov 6, 2017 at 6:00 PM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Mon Nov  6 18:00:51 2017
> New Revision: 317536
>
> URL: http://llvm.org/viewvc/llvm-project?rev=317536&view=rev
> Log:
> Use Path instead of Config->OutputFile. NFC.
>
> This function is always called with Config->OutputFile. That is not
> obvious from reading the function. It should always use Path or take
> no argument and always use Config->OutputFile.
>
> Modified:
>     lld/trunk/ELF/Filesystem.cpp
>
> Modified: lld/trunk/ELF/Filesystem.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/
> Filesystem.cpp?rev=317536&r1=317535&r2=317536&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/Filesystem.cpp (original)
> +++ lld/trunk/ELF/Filesystem.cpp Mon Nov  6 18:00:51 2017
> @@ -38,8 +38,8 @@ using namespace lld::elf;
>  // This function spawns a background thread to call unlink.
>  // The calling thread returns almost immediately.
>  void elf::unlinkAsync(StringRef Path) {
> -  if (!ThreadsEnabled || !sys::fs::exists(Config->OutputFile) ||
> -      !sys::fs::is_regular_file(Config->OutputFile))
> +  if (!ThreadsEnabled || !sys::fs::exists(Path) ||
> +      !sys::fs::is_regular_file(Path))
>      return;
>
>    // First, rename Path to avoid race condition. We cannot remove
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171106/bdf202c6/attachment.html>


More information about the llvm-commits mailing list