<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 8, 2016 at 3:30 AM, Rafael Espíndola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">emitError takes a twine and I don't think it is safe to have a twine<br>
variable. Could this be just:<br>
<br>
emitError(Twine("could not write object file: ") + Filename);<br></blockquote><div><br></div><div>Right, this isn't safe. Per Twine.h:</div><div><div>  /// A Twine is not intended for use directly and should not be stored, its</div><div>  /// implementation relies on the ability to store pointers to temporary stack</div><div>  /// objects which may be deallocated at the end of a statement. Twines should</div><div>  /// only be used accepted as const references in arguments, when an API wishes</div><div>  /// to accept possibly-concatenated strings.</div></div><div><br></div><div>Please change to Rafael's suggestion.</div><div><br></div><div>Thanks!</div><div>Teresa</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Cheers,<br>
Rafael<br>
<br>
<br>
On 7 November 2016 at 18:43, Eli Friedman via llvm-commits<br>
<div class="m_-3463480011682684075gmail-m_-3093138850871892087gmail-HOEnZb"><div class="m_-3463480011682684075gmail-m_-3093138850871892087gmail-h5"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: efriedma<br>
> Date: Mon Nov  7 17:43:07 2016<br>
> New Revision: 286177<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=286177&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=286177&view=rev</a><br>
> Log:<br>
> [LTO] Add error message on IO error in compileOptimizedToFile.<br>
><br>
> (No testcase because it's difficult to force an error here.)<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D26371" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2637<wbr>1</a><br>
><br>
><br>
> Modified:<br>
>     llvm/trunk/lib/LTO/LTOCodeGen<wbr>erator.cpp<br>
><br>
> Modified: llvm/trunk/lib/LTO/LTOCodeGene<wbr>rator.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=286177&r1=286176&r2=286177&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/LTO/LTOCo<wbr>deGenerator.cpp?rev=286177&r1=<wbr>286176&r2=286177&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/lib/LTO/LTOCodeGene<wbr>rator.cpp (original)<br>
> +++ llvm/trunk/lib/LTO/LTOCodeGene<wbr>rator.cpp Mon Nov  7 17:43:07 2016<br>
> @@ -257,6 +257,8 @@ bool LTOCodeGenerator::compileOptim<wbr>izedT<br>
>    bool genResult = compileOptimized(&objFile.os()<wbr>);<br>
>    objFile.os().close();<br>
>    if (objFile.os().has_error()) {<br>
> +    Twine ErrMsg = "could not write object file: " + Filename.str();<br>
> +    emitError(ErrMsg.str());<br>
>      objFile.os().clear_error();<br>
>      sys::fs::remove(Twine(Filename<wbr>));<br>
>      return false;<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">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/<wbr>mailman/listinfo/llvm-commits</a><br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">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/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-3463480011682684075gmail-m_-3093138850871892087gmail_signature"><span style="font-family:times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> <a href="tel:(408)%20460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</div></div>