[llvm] r253566 - llvm/lib/Support/TargetParser.cpp: Rework llvm::ARM::getArchExtFeature() to avoid abuse of Twine in r253470.
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 19 07:48:01 PST 2015
Fixed it up in r253570. Thanks.
I just forgot startswith.
On Fri, Nov 20, 2015 at 12:21 AM Yaron Keren <yaron.keren at gmail.com> wrote:
> Thanks! I was just looking into this.
>
> ArchExt.startswith("no") is nicer, if you like.
>
>
> 2015-11-19 17:03 GMT+02:00 NAKAMURA Takumi via llvm-commits <
> llvm-commits at lists.llvm.org>:
>
>> Author: chapuni
>> Date: Thu Nov 19 09:03:11 2015
>> New Revision: 253566
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=253566&view=rev
>> Log:
>> llvm/lib/Support/TargetParser.cpp: Rework llvm::ARM::getArchExtFeature()
>> to avoid abuse of Twine in r253470.
>>
>> Modified:
>> llvm/trunk/lib/Support/TargetParser.cpp
>>
>> Modified: llvm/trunk/lib/Support/TargetParser.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetParser.cpp?rev=253566&r1=253565&r2=253566&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Support/TargetParser.cpp (original)
>> +++ llvm/trunk/lib/Support/TargetParser.cpp Thu Nov 19 09:03:11 2015
>> @@ -87,7 +87,6 @@ static const struct {
>> const char *NegFeature;
>>
>> StringRef getName() const { return StringRef(NameCStr, NameLength); }
>> - StringRef getNegName() const { return (Twine("no") + getName()).str();
>> }
>> } ARCHExtNames[] = {
>> #define ARM_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) \
>> { NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE },
>> @@ -332,11 +331,16 @@ StringRef llvm::ARM::getArchExtName(unsi
>> }
>>
>> const char *llvm::ARM::getArchExtFeature(StringRef ArchExt) {
>> + if (ArchExt.substr(0, 2) == "no") {
>> + StringRef ArchExtBase(ArchExt.substr(2));
>> + for (const auto AE : ARCHExtNames) {
>> + if (AE.NegFeature && ArchExtBase == AE.getName())
>> + return AE.NegFeature;
>> + }
>> + }
>> for (const auto AE : ARCHExtNames) {
>> if (AE.Feature && ArchExt == AE.getName())
>> return AE.Feature;
>> - else if (AE.NegFeature && ArchExt == AE.getNegName())
>> - return AE.NegFeature;
>> }
>>
>> return nullptr;
>>
>>
>> _______________________________________________
>> 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/20151119/a92487d8/attachment.html>
More information about the llvm-commits
mailing list