[llvm] r303493 - COFF: Fix single StringRef return error

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 11:44:24 PDT 2017


Do you need the explicit "StringRef()" around the Twine expression here?

(do you need the explicit "Twine()" here either? Or would:
make_error<StringError>((S + ...).str(),
suffice?)

On Sat, May 20, 2017 at 2:00 PM Martell Malone via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: martell
> Date: Sat May 20 16:00:36 2017
> New Revision: 303493
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303493&view=rev
> Log:
> COFF: Fix single StringRef return error
>
> This should appease the lld build bot regression
> Intrroduced by rL303490
>
> Modified:
>     llvm/trunk/lib/Object/COFFImportFile.cpp
>
> Modified: llvm/trunk/lib/Object/COFFImportFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFImportFile.cpp?rev=303493&r1=303492&r2=303493&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/COFFImportFile.cpp (original)
> +++ llvm/trunk/lib/Object/COFFImportFile.cpp Sat May 20 16:00:36 2017
> @@ -111,8 +111,8 @@ static Expected<std::string> replace(Str
>
>    if (Pos == StringRef::npos) {
>      return make_error<StringError>(
> -      Twine(S + ": replacing '" + From + "' with '" + To + "' failed")
> -      .getSingleStringRef(), object_error::parse_failed);
> +      StringRef(Twine(S + ": replacing '" + From +
> +        "' with '" + To + "' failed").str()), object_error::parse_failed);
>    }
>
>    return (Twine(S.substr(0, Pos)) + To + S.substr(Pos +
> From.size())).str();
>
>
> _______________________________________________
> 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/20170522/882acab5/attachment.html>


More information about the llvm-commits mailing list