[llvm] r263914 - [gold] Emit a diagnostic in case we fail to remove a file.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 05:54:15 PDT 2016


It should be possible to test this.

Interesting cases: we error if the output is a directory. We do not error
in "no such file or directory". We exit with non zero on error.

Cheers,
Rafael
On Mar 20, 2016 4:17 PM, "Davide Italiano via llvm-commits" <
llvm-commits at lists.llvm.org> wrote:

> Author: davide
> Date: Sun Mar 20 15:12:33 2016
> New Revision: 263914
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263914&view=rev
> Log:
> [gold] Emit a diagnostic in case we fail to remove a file.
>
> Modified:
>     llvm/trunk/tools/gold/gold-plugin.cpp
>
> Modified: llvm/trunk/tools/gold/gold-plugin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=263914&r1=263913&r2=263914&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/gold/gold-plugin.cpp (original)
> +++ llvm/trunk/tools/gold/gold-plugin.cpp Sun Mar 20 15:12:33 2016
> @@ -1289,10 +1289,14 @@ static ld_plugin_status all_symbols_read
>
>    if (options::TheOutputType == options::OT_BC_ONLY ||
>        options::TheOutputType == options::OT_DISABLE) {
> -    if (options::TheOutputType == options::OT_DISABLE)
> +    if (options::TheOutputType == options::OT_DISABLE) {
>        // Remove the output file here since ld.bfd creates the output file
>        // early.
> -      sys::fs::remove(output_name);
> +      std::error_code EC = sys::fs::remove(output_name);
> +      if (EC)
> +        message(LDPL_ERROR, "Failed to delete '%s': %s",
> output_name.c_str(),
> +                EC.message().c_str());
> +    }
>      exit(0);
>    }
>
>
>
> _______________________________________________
> 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/20160321/6455489b/attachment.html>


More information about the llvm-commits mailing list