[llvm] r286177 - [LTO] Add error message on IO error in compileOptimizedToFile.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 03:30:44 PST 2016


emitError takes a twine and I don't think it is safe to have a twine
variable. Could this be just:

emitError(Twine("could not write object file: ") + Filename);

Cheers,
Rafael


On 7 November 2016 at 18:43, Eli Friedman via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: efriedma
> Date: Mon Nov  7 17:43:07 2016
> New Revision: 286177
>
> URL: http://llvm.org/viewvc/llvm-project?rev=286177&view=rev
> Log:
> [LTO] Add error message on IO error in compileOptimizedToFile.
>
> (No testcase because it's difficult to force an error here.)
>
> Differential Revision: https://reviews.llvm.org/D26371
>
>
> Modified:
>     llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
>
> Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=286177&r1=286176&r2=286177&view=diff
> ==============================================================================
> --- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
> +++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Mon Nov  7 17:43:07 2016
> @@ -257,6 +257,8 @@ bool LTOCodeGenerator::compileOptimizedT
>    bool genResult = compileOptimized(&objFile.os());
>    objFile.os().close();
>    if (objFile.os().has_error()) {
> +    Twine ErrMsg = "could not write object file: " + Filename.str();
> +    emitError(ErrMsg.str());
>      objFile.os().clear_error();
>      sys::fs::remove(Twine(Filename));
>      return false;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list