[PATCH] D19638: Use llvm:Twine instead of std::to_string.

Chaoren Lin via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 16:07:37 PDT 2016


I thought Twine was just generally more preferred for string concatenation.
But yes, this is necessary for building with the Android NDK.

On Wed, Apr 27, 2016 at 3:56 PM, David Blaikie <dblaikie at gmail.com> wrote:

> Good to have a reason in the commit message/patch description - I assume
> it's because std::to_string isn't available on some platforms? At least
> that's what I recall seeing in previous patches.
>
> On Wed, Apr 27, 2016 at 3:50 PM, Chaoren Lin via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> chaoren created this revision.
>> chaoren added reviewers: lhames, ovyalov, chandlerc.
>> chaoren added a subscriber: llvm-commits.
>>
>> http://reviews.llvm.org/D19638
>>
>> Files:
>>   lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h
>>   lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h
>>   lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOX86_64.h
>>
>> Index: lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOX86_64.h
>> ===================================================================
>> --- lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOX86_64.h
>> +++ lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOX86_64.h
>> @@ -64,9 +64,9 @@
>>      UNIMPLEMENTED_RELOC(MachO::X86_64_RELOC_TLV);
>>      default:
>>        if (RelType > MachO::X86_64_RELOC_TLV)
>> -        return make_error<RuntimeDyldError>("MachO X86_64 relocation
>> type " +
>> -                                            std::to_string(RelType) +
>> -                                            " is out of range");
>> +        return make_error<RuntimeDyldError>(("MachO X86_64 relocation
>> type " +
>> +                                             Twine(RelType) +
>> +                                             " is out of range").str());
>>        break;
>>      }
>>
>> Index: lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h
>> ===================================================================
>> --- lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h
>> +++ lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h
>> @@ -49,19 +49,19 @@
>>                                           ObjSectionToID);
>>        else if (RelType == MachO::GENERIC_RELOC_VANILLA)
>>          return processScatteredVANILLA(SectionID, RelI, Obj,
>> ObjSectionToID);
>> -      return make_error<RuntimeDyldError>("Unhandled I386 scattered
>> relocation "
>> -                                          "type: " +
>> std::to_string(RelType));
>> +      return make_error<RuntimeDyldError>(("Unhandled I386 scattered
>> relocation "
>> +                                           "type: " +
>> Twine(RelType)).str());
>>      }
>>
>>      switch (RelType) {
>>      UNIMPLEMENTED_RELOC(MachO::GENERIC_RELOC_PAIR);
>>      UNIMPLEMENTED_RELOC(MachO::GENERIC_RELOC_PB_LA_PTR);
>>      UNIMPLEMENTED_RELOC(MachO::GENERIC_RELOC_TLV);
>>      default:
>>        if (RelType > MachO::GENERIC_RELOC_TLV)
>> -        return make_error<RuntimeDyldError>("MachO I386 relocation type
>> " +
>> -                                            std::to_string(RelType) +
>> -                                            " is out of range");
>> +        return make_error<RuntimeDyldError>(("MachO I386 relocation type
>> " +
>> +                                             Twine(RelType) +
>> +                                             " is out of range").str());
>>        break;
>>      }
>>
>> Index: lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h
>> ===================================================================
>> --- lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h
>> +++ lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h
>> @@ -82,9 +82,9 @@
>>      UNIMPLEMENTED_RELOC(MachO::ARM_RELOC_HALF);
>>      default:
>>        if (RelType > MachO::ARM_RELOC_HALF_SECTDIFF)
>> -        return make_error<RuntimeDyldError>("MachO ARM relocation type "
>> +
>> -                                            std::to_string(RelType) +
>> -                                            " is out of range");
>> +        return make_error<RuntimeDyldError>(("MachO ARM relocation type
>> " +
>> +                                             Twine(RelType) +
>> +                                             " is out of range").str());
>>        break;
>>      }
>>
>>
>>
>>
>> _______________________________________________
>> 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/20160427/071b961c/attachment.html>


More information about the llvm-commits mailing list