From b6b254582fe4d3108b5238551cce0ed5da6284d6 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Thu, 19 Nov 2015 15:03:11 +0000 Subject: llvm/lib/Support/TargetParser.cpp: Rework llvm::ARM::getArchExtFeature() to avoid abuse of Twine in r253470. llvm-svn: 253566 --- llvm/lib/Support/TargetParser.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Support') diff --git a/llvm/lib/Support/TargetParser.cpp b/llvm/lib/Support/TargetParser.cpp index 213275ab009..371ae35c54a 100644 --- a/llvm/lib/Support/TargetParser.cpp +++ b/llvm/lib/Support/TargetParser.cpp @@ -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(unsigned ArchExtKind) { } 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; -- cgit v1.2.3