<p dir="ltr">It should be possible to test this.</p>
<p dir="ltr">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.</p>
<p dir="ltr">Cheers,<br>
Rafael</p>
<div class="gmail_quote">On Mar 20, 2016 4:17 PM, "Davide Italiano via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davide<br>
Date: Sun Mar 20 15:12:33 2016<br>
New Revision: 263914<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=263914&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=263914&view=rev</a><br>
Log:<br>
[gold] Emit a diagnostic in case we fail to remove a file.<br>
<br>
Modified:<br>
    llvm/trunk/tools/gold/gold-plugin.cpp<br>
<br>
Modified: llvm/trunk/tools/gold/gold-plugin.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=263914&r1=263913&r2=263914&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=263914&r1=263913&r2=263914&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)<br>
+++ llvm/trunk/tools/gold/gold-plugin.cpp Sun Mar 20 15:12:33 2016<br>
@@ -1289,10 +1289,14 @@ static ld_plugin_status all_symbols_read<br>
<br>
   if (options::TheOutputType == options::OT_BC_ONLY ||<br>
       options::TheOutputType == options::OT_DISABLE) {<br>
-    if (options::TheOutputType == options::OT_DISABLE)<br>
+    if (options::TheOutputType == options::OT_DISABLE) {<br>
       // Remove the output file here since ld.bfd creates the output file<br>
       // early.<br>
-      sys::fs::remove(output_name);<br>
+      std::error_code EC = sys::fs::remove(output_name);<br>
+      if (EC)<br>
+        message(LDPL_ERROR, "Failed to delete '%s': %s", output_name.c_str(),<br>
+                EC.message().c_str());<br>
+    }<br>
     exit(0);<br>
   }<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>