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

Martell Malone via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 16:07:11 PDT 2017


Apologies, your name got autocorrected to Davide from David because the
last person I was talking on this thread.

On Tue, May 23, 2017 at 12:04 AM, Martell Malone <martellmalone at gmail.com>
wrote:

> Hey Davide,
>
> I don't think I need the explicit Twine.
> I will do some testing and update with a patch that removes that for both
> this and the other patch.
> From my observation the only condition is that I return a StringRef that
> is constructed with a std::string so I don't hit the assertion.
>
> Thanks again.
> Martell
>
> On Mon, May 22, 2017 at 7:44 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> 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/CO
>>> FFImportFile.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/20170523/7942bbab/attachment.html>


More information about the llvm-commits mailing list