1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00

[llvm] Rename StringRef _lower() method calls to _insensitive()

This is a mechanical change. This actually also renames the
similarly named methods in the SmallString class, however these
methods don't seem to be used outside of the llvm subproject, so
this doesn't break building of the rest of the monorepo.
This commit is contained in:
Martin Storsjö 2021-06-23 14:52:36 +03:00
parent 24c3cf43d7
commit 9d14adb9f6
52 changed files with 233 additions and 234 deletions

View File

@ -93,8 +93,8 @@ public:
}
/// Check for string equality, ignoring case.
bool equals_lower(StringRef RHS) const {
return str().equals_lower(RHS);
bool equals_insensitive(StringRef RHS) const {
return str().equals_insensitive(RHS);
}
/// Compare two strings; the result is -1, 0, or 1 if this string is
@ -103,9 +103,9 @@ public:
return str().compare(RHS);
}
/// compare_lower - Compare two strings, ignoring case.
int compare_lower(StringRef RHS) const {
return str().compare_lower(RHS);
/// compare_insensitive - Compare two strings, ignoring case.
int compare_insensitive(StringRef RHS) const {
return str().compare_insensitive(RHS);
}
/// compare_numeric - Compare two strings, treating sequences of digits as

View File

@ -138,21 +138,21 @@ public:
// Case-insensitive case matchers.
StringSwitch &CaseLower(StringLiteral S, T Value) {
if (!Result && Str.equals_lower(S))
if (!Result && Str.equals_insensitive(S))
Result = std::move(Value);
return *this;
}
StringSwitch &EndsWithLower(StringLiteral S, T Value) {
if (!Result && Str.endswith_lower(S))
if (!Result && Str.endswith_insensitive(S))
Result = Value;
return *this;
}
StringSwitch &StartsWithLower(StringLiteral S, T Value) {
if (!Result && Str.startswith_lower(S))
if (!Result && Str.startswith_insensitive(S))
Result = std::move(Value);
return *this;

View File

@ -75,7 +75,7 @@ protected:
}
static bool consumeHexStyle(StringRef &Str, HexPrintStyle &Style) {
if (!Str.startswith_lower("x"))
if (!Str.startswith_insensitive("x"))
return false;
if (Str.consume_front("x-"))

View File

@ -752,7 +752,7 @@ private:
// that, other than the root, path components should not contain slashes or
// backslashes.
bool pathComponentMatches(llvm::StringRef lhs, llvm::StringRef rhs) const {
if ((CaseSensitive ? lhs.equals(rhs) : lhs.equals_lower(rhs)))
if ((CaseSensitive ? lhs.equals(rhs) : lhs.equals_insensitive(rhs)))
return true;
return (lhs == "/" && rhs == "\\") || (lhs == "\\" && rhs == "/");
}

View File

@ -4590,7 +4590,7 @@ TargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *RI,
continue;
for (const MCPhysReg &PR : *RC) {
if (RegName.equals_lower(RI->getRegAsmName(PR))) {
if (RegName.equals_insensitive(RI->getRegAsmName(PR))) {
std::pair<unsigned, const TargetRegisterClass *> S =
std::make_pair(PR, RC);

View File

@ -163,7 +163,7 @@ static int gsiRecordCmp(StringRef S1, StringRef S2) {
return memcmp(S1.data(), S2.data(), LS);
// Both strings are ascii, perform a case-insensitive comparison.
return S1.compare_lower(S2.data());
return S1.compare_insensitive(S2.data());
}
void GSIStreamBuilder::finalizePublicBuckets() {

View File

@ -1229,7 +1229,7 @@ Pattern::MatchResult Pattern::match(StringRef Buffer,
// If this is a fixed string pattern, just match it now.
if (!FixedStr.empty()) {
size_t Pos =
IgnoreCase ? Buffer.find_lower(FixedStr) : Buffer.find(FixedStr);
IgnoreCase ? Buffer.find_insensitive(FixedStr) : Buffer.find(FixedStr);
if (Pos == StringRef::npos)
return make_error<NotFoundError>();
return MatchResult(Pos, /*MatchLen=*/FixedStr.size(), Error::success());

View File

@ -3239,9 +3239,10 @@ bool AsmParser::parseRealValue(const fltSemantics &Semantics, APInt &Res) {
APFloat Value(Semantics);
StringRef IDVal = getTok().getString();
if (getLexer().is(AsmToken::Identifier)) {
if (!IDVal.compare_lower("infinity") || !IDVal.compare_lower("inf"))
if (!IDVal.compare_insensitive("infinity") ||
!IDVal.compare_insensitive("inf"))
Value = APFloat::getInf(Semantics);
else if (!IDVal.compare_lower("nan"))
else if (!IDVal.compare_insensitive("nan"))
Value = APFloat::getNaN(Semantics, false, ~0);
else
return TokError("invalid floating point literal");

View File

@ -322,11 +322,11 @@ bool COFFMasmParser::ParseDirectiveProc(StringRef Directive, SMLoc Loc) {
if (getLexer().is(AsmToken::Identifier)) {
StringRef nextVal = getTok().getString();
SMLoc nextLoc = getTok().getLoc();
if (nextVal.equals_lower("far")) {
if (nextVal.equals_insensitive("far")) {
// TODO(epastor): Handle far procedure definitions.
Lex();
return Error(nextLoc, "far procedure definitions not yet supported");
} else if (nextVal.equals_lower("near")) {
} else if (nextVal.equals_insensitive("near")) {
Lex();
nextVal = getTok().getString();
nextLoc = getTok().getLoc();
@ -340,7 +340,7 @@ bool COFFMasmParser::ParseDirectiveProc(StringRef Directive, SMLoc Loc) {
bool Framed = false;
if (getLexer().is(AsmToken::Identifier) &&
getTok().getString().equals_lower("frame")) {
getTok().getString().equals_insensitive("frame")) {
Lex();
Framed = true;
getStreamer().EmitWinCFIStartProc(Sym, Loc);

View File

@ -1133,8 +1133,8 @@ const AsmToken &MasmParser::Lex() {
MutableArrayRef<AsmToken> Buf(NextTok);
size_t ReadCount = Lexer.peekTokens(Buf);
if (ReadCount && NextTok.is(AsmToken::Identifier) &&
(NextTok.getString().equals_lower("equ") ||
NextTok.getString().equals_lower("textequ"))) {
(NextTok.getString().equals_insensitive("equ") ||
NextTok.getString().equals_insensitive("textequ"))) {
// This looks like an EQU or TEXTEQU directive; don't expand the
// identifier, allowing for redefinitions.
break;
@ -1515,7 +1515,7 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
}
}
// Parse named bitwise negation.
if (Identifier.equals_lower("not")) {
if (Identifier.equals_insensitive("not")) {
if (parsePrimaryExpr(Res, EndLoc, nullptr))
return true;
Res = MCUnaryExpr::createNot(Res, getContext(), FirstTokenLoc);
@ -2082,7 +2082,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
if (!IDVal.startswith("."))
return Error(IDLoc, "unexpected token at start of statement");
} else if (Lexer.is(AsmToken::Identifier) &&
getTok().getString().equals_lower("echo")) {
getTok().getString().equals_insensitive("echo")) {
// Intercept echo early to avoid lexical substitution in its message, and
// delegate all handling to the appropriate function.
return parseDirectiveEcho();
@ -2260,7 +2260,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
// Special-case handling of structure-end directives at higher priority,
// since ENDS is overloaded as a segment-end directive.
if (IDVal.equals_lower("ends") && StructInProgress.size() > 1 &&
if (IDVal.equals_insensitive("ends") && StructInProgress.size() > 1 &&
getTok().is(AsmToken::EndOfStatement)) {
return parseDirectiveNestedEnds();
}
@ -2496,7 +2496,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
// Special-case handling of structure-end directives at higher priority, since
// ENDS is overloaded as a segment-end directive.
if (nextVal.equals_lower("ends") && StructInProgress.size() == 1) {
if (nextVal.equals_insensitive("ends") && StructInProgress.size() == 1) {
Lex();
return parseDirectiveEnds(IDVal, IDLoc);
}
@ -2527,7 +2527,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
return parseDirectiveEquate(nextVal, IDVal, DirKind, IDLoc);
case DK_BYTE:
if (afterNextTok.is(AsmToken::Identifier) &&
afterNextTok.getString().equals_lower("ptr")) {
afterNextTok.getString().equals_insensitive("ptr")) {
// Size directive; part of an instruction.
break;
}
@ -2538,7 +2538,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
return parseDirectiveNamedValue(nextVal, 1, IDVal, IDLoc);
case DK_WORD:
if (afterNextTok.is(AsmToken::Identifier) &&
afterNextTok.getString().equals_lower("ptr")) {
afterNextTok.getString().equals_insensitive("ptr")) {
// Size directive; part of an instruction.
break;
}
@ -2549,7 +2549,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
return parseDirectiveNamedValue(nextVal, 2, IDVal, IDLoc);
case DK_DWORD:
if (afterNextTok.is(AsmToken::Identifier) &&
afterNextTok.getString().equals_lower("ptr")) {
afterNextTok.getString().equals_insensitive("ptr")) {
// Size directive; part of an instruction.
break;
}
@ -2560,7 +2560,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
return parseDirectiveNamedValue(nextVal, 4, IDVal, IDLoc);
case DK_FWORD:
if (afterNextTok.is(AsmToken::Identifier) &&
afterNextTok.getString().equals_lower("ptr")) {
afterNextTok.getString().equals_insensitive("ptr")) {
// Size directive; part of an instruction.
break;
}
@ -2570,7 +2570,7 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
return parseDirectiveNamedValue(nextVal, 6, IDVal, IDLoc);
case DK_QWORD:
if (afterNextTok.is(AsmToken::Identifier) &&
afterNextTok.getString().equals_lower("ptr")) {
afterNextTok.getString().equals_insensitive("ptr")) {
// Size directive; part of an instruction.
break;
}
@ -3594,7 +3594,7 @@ bool MasmParser::parseScalarInitializer(unsigned Size,
if (parseExpression(Value))
return true;
if (getTok().is(AsmToken::Identifier) &&
getTok().getString().equals_lower("dup")) {
getTok().getString().equals_insensitive("dup")) {
Lex(); // Eat 'dup'.
const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value);
if (!MCE)
@ -3752,11 +3752,11 @@ bool MasmParser::parseRealValue(const fltSemantics &Semantics, APInt &Res) {
APFloat Value(Semantics);
StringRef IDVal = getTok().getString();
if (getLexer().is(AsmToken::Identifier)) {
if (IDVal.equals_lower("infinity") || IDVal.equals_lower("inf"))
if (IDVal.equals_insensitive("infinity") || IDVal.equals_insensitive("inf"))
Value = APFloat::getInf(Semantics);
else if (IDVal.equals_lower("nan"))
else if (IDVal.equals_insensitive("nan"))
Value = APFloat::getNaN(Semantics, false, ~0);
else if (IDVal.equals_lower("?"))
else if (IDVal.equals_insensitive("?"))
Value = APFloat::getZero(Semantics);
else
return TokError("invalid floating point literal");
@ -3798,7 +3798,7 @@ bool MasmParser::parseRealInstList(const fltSemantics &Semantics,
getTok().isNot(AsmToken::GreaterGreater))) {
const AsmToken NextTok = peekTok();
if (NextTok.is(AsmToken::Identifier) &&
NextTok.getString().equals_lower("dup")) {
NextTok.getString().equals_insensitive("dup")) {
const MCExpr *Value;
if (parseExpression(Value) || parseToken(AsmToken::Identifier))
return true;
@ -4162,7 +4162,7 @@ bool MasmParser::parseStructInstList(
getTok().isNot(AsmToken::GreaterGreater))) {
const AsmToken NextTok = peekTok();
if (NextTok.is(AsmToken::Identifier) &&
NextTok.getString().equals_lower("dup")) {
NextTok.getString().equals_insensitive("dup")) {
const MCExpr *Value;
if (parseExpression(Value) || parseToken(AsmToken::Identifier))
return true;
@ -4445,7 +4445,7 @@ bool MasmParser::parseDirectiveStruct(StringRef Directive,
QualifierLoc = getTok().getLoc();
if (parseIdentifier(Qualifier))
return addErrorSuffix(" in '" + Twine(Directive) + "' directive");
if (!Qualifier.equals_lower("nonunique"))
if (!Qualifier.equals_insensitive("nonunique"))
return Error(QualifierLoc, "Unrecognized qualifier for '" +
Twine(Directive) +
"' directive; expected none or NONUNIQUE");
@ -4489,7 +4489,7 @@ bool MasmParser::parseDirectiveEnds(StringRef Name, SMLoc NameLoc) {
return Error(NameLoc, "ENDS directive without matching STRUC/STRUCT/UNION");
if (StructInProgress.size() > 1)
return Error(NameLoc, "unexpected name in nested ENDS directive");
if (StructInProgress.back().Name.compare_lower(Name))
if (StructInProgress.back().Name.compare_insensitive(Name))
return Error(NameLoc, "mismatched name in ENDS directive; expected '" +
StructInProgress.back().Name + "'");
StructInfo Structure = StructInProgress.pop_back_val();
@ -5635,7 +5635,7 @@ bool MasmParser::parseDirectiveMacro(StringRef Name, SMLoc NameLoc) {
// Emit an error if two (or more) named parameters share the same name.
for (const MCAsmMacroParameter& CurrParam : Parameters)
if (CurrParam.Name.equals_lower(Parameter.Name))
if (CurrParam.Name.equals_insensitive(Parameter.Name))
return TokError("macro '" + Name + "' has multiple parameters"
" named '" + Parameter.Name + "'");
@ -5660,9 +5660,9 @@ bool MasmParser::parseDirectiveMacro(StringRef Name, SMLoc NameLoc) {
Parameter.Name + "' in macro '" + Name +
"'");
if (Qualifier.equals_lower("req"))
if (Qualifier.equals_insensitive("req"))
Parameter.Required = true;
else if (Qualifier.equals_lower("vararg"))
else if (Qualifier.equals_insensitive("vararg"))
Parameter.Vararg = true;
else
return Error(QualLoc,
@ -5682,7 +5682,7 @@ bool MasmParser::parseDirectiveMacro(StringRef Name, SMLoc NameLoc) {
std::vector<std::string> Locals;
if (getTok().is(AsmToken::Identifier) &&
getTok().getIdentifier().equals_lower("local")) {
getTok().getIdentifier().equals_insensitive("local")) {
Lex(); // Eat the LOCAL directive.
StringRef ID;
@ -5716,7 +5716,7 @@ bool MasmParser::parseDirectiveMacro(StringRef Name, SMLoc NameLoc) {
// Otherwise, check whether we have reached the 'endm'... and determine if
// this is a macro function.
if (getLexer().is(AsmToken::Identifier)) {
if (getTok().getIdentifier().equals_lower("endm")) {
if (getTok().getIdentifier().equals_insensitive("endm")) {
if (MacroDepth == 0) { // Outermost macro.
EndToken = getTok();
Lexer.Lex();
@ -5728,7 +5728,7 @@ bool MasmParser::parseDirectiveMacro(StringRef Name, SMLoc NameLoc) {
// Otherwise we just found the end of an inner macro.
--MacroDepth;
}
} else if (getTok().getIdentifier().equals_lower("exitm")) {
} else if (getTok().getIdentifier().equals_insensitive("exitm")) {
if (MacroDepth == 0 && peekTok().isNot(AsmToken::EndOfStatement)) {
IsMacroFunction = true;
}
@ -6053,7 +6053,7 @@ bool MasmParser::parseDirectiveIfidn(SMLoc DirectiveLoc, bool ExpectEqual,
TheCondState.TheCond = AsmCond::IfCond;
if (CaseInsensitive)
TheCondState.CondMet =
ExpectEqual == (StringRef(String1).equals_lower(String2));
ExpectEqual == (StringRef(String1).equals_insensitive(String2));
else
TheCondState.CondMet = ExpectEqual == (String1 == String2);
TheCondState.Ignore = !TheCondState.CondMet;
@ -6263,7 +6263,7 @@ bool MasmParser::parseDirectiveElseIfidn(SMLoc DirectiveLoc, bool ExpectEqual,
if (CaseInsensitive)
TheCondState.CondMet =
ExpectEqual == (StringRef(String1).equals_lower(String2));
ExpectEqual == (StringRef(String1).equals_insensitive(String2));
else
TheCondState.CondMet = ExpectEqual == (String1 == String2);
TheCondState.Ignore = !TheCondState.CondMet;
@ -6443,13 +6443,13 @@ bool MasmParser::parseDirectiveErrorIfidn(SMLoc DirectiveLoc, bool ExpectEqual,
if (CaseInsensitive)
TheCondState.CondMet =
ExpectEqual == (StringRef(String1).equals_lower(String2));
ExpectEqual == (StringRef(String1).equals_insensitive(String2));
else
TheCondState.CondMet = ExpectEqual == (String1 == String2);
TheCondState.Ignore = !TheCondState.CondMet;
if ((CaseInsensitive &&
ExpectEqual == StringRef(String1).equals_lower(String2)) ||
ExpectEqual == StringRef(String1).equals_insensitive(String2)) ||
(ExpectEqual == (String1 == String2)))
return Error(DirectiveLoc, Message);
return false;
@ -6634,7 +6634,7 @@ bool MasmParser::isMacroLikeDirective() {
return true;
}
if (peekTok().is(AsmToken::Identifier) &&
peekTok().getIdentifier().equals_lower("macro"))
peekTok().getIdentifier().equals_insensitive("macro"))
return true;
return false;
@ -6656,7 +6656,7 @@ MCAsmMacro *MasmParser::parseMacroLikeBody(SMLoc DirectiveLoc) {
// Otherwise, check whether we have reached the endm.
if (Lexer.is(AsmToken::Identifier) &&
getTok().getIdentifier().equals_lower("endm")) {
getTok().getIdentifier().equals_insensitive("endm")) {
if (NestLevel == 0) {
EndToken = getTok();
Lex();
@ -6846,7 +6846,7 @@ bool MasmParser::parseDirectiveFor(SMLoc DirectiveLoc, StringRef Dir) {
Parameter.Name + "' in '" + Dir +
"' directive");
if (Qualifier.equals_lower("req"))
if (Qualifier.equals_insensitive("req"))
Parameter.Required = true;
else
return Error(QualLoc,
@ -7010,7 +7010,7 @@ bool MasmParser::parseDirectiveEcho() {
// substitutions in the message. Assert that the next token is the directive,
// then eat it without using the Parser's Lex method.
assert(getTok().is(AsmToken::Identifier) &&
getTok().getString().equals_lower("echo"));
getTok().getString().equals_insensitive("echo"));
Lexer.Lex();
std::string Message = parseStringTo(AsmToken::EndOfStatement);

View File

@ -184,8 +184,7 @@ static unsigned matchOption(const OptTable::Info *I, StringRef Str,
StringRef Prefix(*Pre);
if (Str.startswith(Prefix)) {
StringRef Rest = Str.substr(Prefix.size());
bool Matched = IgnoreCase
? Rest.startswith_lower(I->Name)
bool Matched = IgnoreCase ? Rest.startswith_insensitive(I->Name)
: Rest.startswith(I->Name);
if (Matched)
return Prefix.size() + StringRef(I->Name).size();

View File

@ -159,16 +159,16 @@ Error TextInstrProfReader::readHeader() {
while (Line->startswith(":")) {
StringRef Str = Line->substr(1);
if (Str.equals_lower("ir"))
if (Str.equals_insensitive("ir"))
IsIRInstr = true;
else if (Str.equals_lower("fe"))
else if (Str.equals_insensitive("fe"))
IsIRInstr = false;
else if (Str.equals_lower("csir")) {
else if (Str.equals_insensitive("csir")) {
IsIRInstr = true;
IsCS = true;
} else if (Str.equals_lower("entry_first"))
} else if (Str.equals_insensitive("entry_first"))
IsEntryFirst = true;
else if (Str.equals_lower("not_entry_first"))
else if (Str.equals_insensitive("not_entry_first"))
IsEntryFirst = false;
else
return error(instrprof_error::bad_header);

View File

@ -25,7 +25,7 @@ StringRef::size_type llvm::StrInStrNoCase(StringRef s1, StringRef s2) {
if (N > M)
return StringRef::npos;
for (size_t i = 0, e = M - N + 1; i != e; ++i)
if (s1.substr(i, N).equals_lower(s2))
if (s1.substr(i, N).equals_insensitive(s2))
return i;
return StringRef::npos;
}

View File

@ -1318,12 +1318,13 @@ class llvm::vfs::RedirectingFileSystemParser {
if (!parseScalarString(N, Value, Storage))
return false;
if (Value.equals_lower("true") || Value.equals_lower("on") ||
Value.equals_lower("yes") || Value == "1") {
if (Value.equals_insensitive("true") || Value.equals_insensitive("on") ||
Value.equals_insensitive("yes") || Value == "1") {
Result = true;
return true;
} else if (Value.equals_lower("false") || Value.equals_lower("off") ||
Value.equals_lower("no") || Value == "0") {
} else if (Value.equals_insensitive("false") ||
Value.equals_insensitive("off") ||
Value.equals_insensitive("no") || Value == "0") {
Result = false;
return true;
}

View File

@ -669,7 +669,7 @@ static bool isReservedName(StringRef path) {
// Then compare against the list of ancient reserved names.
for (size_t i = 0; i < array_lengthof(sReservedNames); ++i) {
if (path.equals_lower(sReservedNames[i]))
if (path.equals_insensitive(sReservedNames[i]))
return true;
}

View File

@ -8038,7 +8038,7 @@ AArch64TargetLowering::getRegForInlineAsmConstraint(
: std::make_pair(0U, &AArch64::PPRRegClass);
}
}
if (StringRef("{cc}").equals_lower(Constraint))
if (StringRef("{cc}").equals_insensitive(Constraint))
return std::make_pair(unsigned(AArch64::NZCV), &AArch64::CCRRegClass);
// Use the default implementation in TargetLowering to convert the register

View File

@ -73,8 +73,8 @@ static bool ShouldSignWithBKey(const Function &F) {
const StringRef Key =
F.getFnAttribute("sign-return-address-key").getValueAsString();
assert(Key.equals_lower("a_key") || Key.equals_lower("b_key"));
return Key.equals_lower("b_key");
assert(Key.equals_insensitive("a_key") || Key.equals_insensitive("b_key"));
return Key.equals_insensitive("b_key");
}
AArch64FunctionInfo::AArch64FunctionInfo(MachineFunction &MF) : MF(MF) {
@ -94,9 +94,11 @@ AArch64FunctionInfo::AArch64FunctionInfo(MachineFunction &MF) : MF(MF) {
return;
}
const StringRef BTIEnable = F.getFnAttribute("branch-target-enforcement").getValueAsString();
assert(BTIEnable.equals_lower("true") || BTIEnable.equals_lower("false"));
BranchTargetEnforcement = BTIEnable.equals_lower("true");
const StringRef BTIEnable =
F.getFnAttribute("branch-target-enforcement").getValueAsString();
assert(BTIEnable.equals_insensitive("true") ||
BTIEnable.equals_insensitive("false"));
BranchTargetEnforcement = BTIEnable.equals_insensitive("true");
}
bool AArch64FunctionInfo::shouldSignReturnAddress(bool SpillsLR) const {

View File

@ -2707,7 +2707,7 @@ AArch64AsmParser::tryParseImmWithOptionalShift(OperandVector &Operands) {
// The optional operand must be "lsl #N" where N is non-negative.
if (!Parser.getTok().is(AsmToken::Identifier) ||
!Parser.getTok().getIdentifier().equals_lower("lsl")) {
!Parser.getTok().getIdentifier().equals_insensitive("lsl")) {
Error(Parser.getTok().getLoc(), "only 'lsl #+N' valid after immediate");
return MatchOperand_ParseFail;
}
@ -3669,9 +3669,10 @@ bool AArch64AsmParser::parseOptionalMulOperand(OperandVector &Operands) {
// Some SVE instructions have a decoration after the immediate, i.e.
// "mul vl". We parse them here and add tokens, which must be present in the
// asm string in the tablegen instruction.
bool NextIsVL = Parser.getLexer().peekTok().getString().equals_lower("vl");
bool NextIsVL =
Parser.getLexer().peekTok().getString().equals_insensitive("vl");
bool NextIsHash = Parser.getLexer().peekTok().is(AsmToken::Hash);
if (!Parser.getTok().getString().equals_lower("mul") ||
if (!Parser.getTok().getString().equals_insensitive("mul") ||
!(NextIsVL || NextIsHash))
return true;
@ -5442,7 +5443,7 @@ bool AArch64AsmParser::parseDirectiveArch(SMLoc L) {
for (auto Name : RequestedExtensions) {
bool EnableFeature = true;
if (Name.startswith_lower("no")) {
if (Name.startswith_insensitive("no")) {
EnableFeature = false;
Name = Name.substr(2);
}
@ -5478,7 +5479,7 @@ bool AArch64AsmParser::parseDirectiveArchExtension(SMLoc L) {
return true;
bool EnableFeature = true;
if (Name.startswith_lower("no")) {
if (Name.startswith_insensitive("no")) {
EnableFeature = false;
Name = Name.substr(2);
}
@ -5544,7 +5545,7 @@ bool AArch64AsmParser::parseDirectiveCPU(SMLoc L) {
bool EnableFeature = true;
if (Name.startswith_lower("no")) {
if (Name.startswith_insensitive("no")) {
EnableFeature = false;
Name = Name.substr(2);
}

View File

@ -1370,9 +1370,9 @@ bool AMDGPULibCalls::fold_wavefrontsize(CallInst *CI, IRBuilder<> &B) {
StringRef CPU = TM->getTargetCPU();
StringRef Features = TM->getTargetFeatureString();
if ((CPU.empty() || CPU.equals_lower("generic")) &&
if ((CPU.empty() || CPU.equals_insensitive("generic")) &&
(Features.empty() ||
Features.find_lower("wavefrontsize") == StringRef::npos))
Features.find_insensitive("wavefrontsize") == StringRef::npos))
return false;
Function *F = CI->getParent()->getParent();

View File

@ -98,12 +98,12 @@ GCNSubtarget::initializeSubtargetDependencies(const Triple &TT,
FullFS += "+enable-prt-strict-null,"; // This is overridden by a disable in FS
// Disable mutually exclusive bits.
if (FS.find_lower("+wavefrontsize") != StringRef::npos) {
if (FS.find_lower("wavefrontsize16") == StringRef::npos)
if (FS.find_insensitive("+wavefrontsize") != StringRef::npos) {
if (FS.find_insensitive("wavefrontsize16") == StringRef::npos)
FullFS += "-wavefrontsize16,";
if (FS.find_lower("wavefrontsize32") == StringRef::npos)
if (FS.find_insensitive("wavefrontsize32") == StringRef::npos)
FullFS += "-wavefrontsize32,";
if (FS.find_lower("wavefrontsize64") == StringRef::npos)
if (FS.find_insensitive("wavefrontsize64") == StringRef::npos)
FullFS += "-wavefrontsize64,";
}

View File

@ -18632,7 +18632,7 @@ RCPair ARMTargetLowering::getRegForInlineAsmConstraint(
break;
}
if (StringRef("{cc}").equals_lower(Constraint))
if (StringRef("{cc}").equals_insensitive(Constraint))
return std::make_pair(unsigned(ARM::CPSR), &ARM::CCRRegClass);
return TargetLowering::getRegForInlineAsmConstraint(TRI, Constraint, VT);

View File

@ -5012,7 +5012,7 @@ ARMAsmParser::parseTraceSyncBarrierOptOperand(OperandVector &Operands) {
if (Tok.isNot(AsmToken::Identifier))
return MatchOperand_NoMatch;
if (!Tok.getString().equals_lower("csync"))
if (!Tok.getString().equals_insensitive("csync"))
return MatchOperand_NoMatch;
Parser.Lex(); // Eat identifier token.
@ -5032,7 +5032,7 @@ ARMAsmParser::parseInstSyncBarrierOptOperand(OperandVector &Operands) {
if (Tok.is(AsmToken::Identifier)) {
StringRef OptStr = Tok.getString();
if (OptStr.equals_lower("sy"))
if (OptStr.equals_insensitive("sy"))
Opt = ARM_ISB::SY;
else
return MatchOperand_NoMatch;
@ -6194,7 +6194,7 @@ bool ARMAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
return true;
// If this is VMRS, check for the apsr_nzcv operand.
if (Mnemonic == "vmrs" &&
Parser.getTok().getString().equals_lower("apsr_nzcv")) {
Parser.getTok().getString().equals_insensitive("apsr_nzcv")) {
S = Parser.getTok().getLoc();
Parser.Lex();
Operands.push_back(ARMOperand::CreateToken("APSR_nzcv", S));
@ -12278,7 +12278,7 @@ bool ARMAsmParser::enableArchExtFeature(StringRef Name, SMLoc &ExtLoc) {
{ARM::AEK_XSCALE, {}, {}},
};
bool EnableFeature = true;
if (Name.startswith_lower("no")) {
if (Name.startswith_insensitive("no")) {
EnableFeature = false;
Name = Name.substr(2);
}

View File

@ -510,19 +510,19 @@ bool HexagonAsmParser::matchBundleOptions() {
"supported with this architecture";
StringRef Option = Parser.getTok().getString();
auto IDLoc = Parser.getTok().getLoc();
if (Option.compare_lower("endloop01") == 0) {
if (Option.compare_insensitive("endloop01") == 0) {
HexagonMCInstrInfo::setInnerLoop(MCB);
HexagonMCInstrInfo::setOuterLoop(MCB);
} else if (Option.compare_lower("endloop0") == 0) {
} else if (Option.compare_insensitive("endloop0") == 0) {
HexagonMCInstrInfo::setInnerLoop(MCB);
} else if (Option.compare_lower("endloop1") == 0) {
} else if (Option.compare_insensitive("endloop1") == 0) {
HexagonMCInstrInfo::setOuterLoop(MCB);
} else if (Option.compare_lower("mem_noshuf") == 0) {
} else if (Option.compare_insensitive("mem_noshuf") == 0) {
if (getSTI().getFeatureBits()[Hexagon::FeatureMemNoShuf])
HexagonMCInstrInfo::setMemReorderDisabled(MCB);
else
return getParser().Error(IDLoc, MemNoShuffMsg);
} else if (Option.compare_lower("mem_no_order") == 0) {
} else if (Option.compare_insensitive("mem_no_order") == 0) {
// Nothing.
} else
return getParser().Error(IDLoc, llvm::Twine("'") + Option +
@ -838,7 +838,8 @@ static bool previousEqual(OperandVector &Operands, size_t Index,
MCParsedAsmOperand &Operand = *Operands[Operands.size() - Index - 1];
if (!Operand.isToken())
return false;
return static_cast<HexagonOperand &>(Operand).getToken().equals_lower(String);
return static_cast<HexagonOperand &>(Operand).getToken().equals_insensitive(
String);
}
static bool previousIsLoop(OperandVector &Operands, size_t Index) {
@ -892,7 +893,7 @@ bool HexagonAsmParser::parseOperand(OperandVector &Operands) {
HexagonOperand::CreateReg(getContext(), Register, Begin, End));
const AsmToken &MaybeDotNew = Lexer.getTok();
if (MaybeDotNew.is(AsmToken::TokenKind::Identifier) &&
MaybeDotNew.getString().equals_lower(".new"))
MaybeDotNew.getString().equals_insensitive(".new"))
splitIdentifier(Operands);
Operands.push_back(
HexagonOperand::CreateToken(getContext(), RParen, Begin));
@ -910,7 +911,7 @@ bool HexagonAsmParser::parseOperand(OperandVector &Operands) {
HexagonOperand::CreateReg(getContext(), Register, Begin, End));
const AsmToken &MaybeDotNew = Lexer.getTok();
if (MaybeDotNew.is(AsmToken::TokenKind::Identifier) &&
MaybeDotNew.getString().equals_lower(".new"))
MaybeDotNew.getString().equals_insensitive(".new"))
splitIdentifier(Operands);
Operands.push_back(
HexagonOperand::CreateToken(getContext(), RParen, Begin));

View File

@ -637,9 +637,9 @@ bool HexagonMCInstrInfo::isOrderedDuplexPair(MCInstrInfo const &MCII,
return false;
}
if (STI.getCPU().equals_lower("hexagonv5") ||
STI.getCPU().equals_lower("hexagonv55") ||
STI.getCPU().equals_lower("hexagonv60")) {
if (STI.getCPU().equals_insensitive("hexagonv5") ||
STI.getCPU().equals_insensitive("hexagonv55") ||
STI.getCPU().equals_insensitive("hexagonv60")) {
// If a store appears, it must be in slot 0 (MIa) 1st, and then slot 1 (MIb);
// therefore, not duplexable if slot 1 is a store, and slot 0 is not.
if ((MIbG == HexagonII::HSIG_S1) || (MIbG == HexagonII::HSIG_S2)) {

View File

@ -754,9 +754,9 @@ std::unique_ptr<LanaiOperand> LanaiAsmParser::parseIdentifier() {
return nullptr;
// Check if identifier has a modifier
if (Identifier.equals_lower("hi"))
if (Identifier.equals_insensitive("hi"))
Kind = LanaiMCExpr::VK_Lanai_ABS_HI;
else if (Identifier.equals_lower("lo"))
else if (Identifier.equals_insensitive("lo"))
Kind = LanaiMCExpr::VK_Lanai_ABS_LO;
// If the identifier corresponds to a variant then extract the real

View File

@ -327,7 +327,7 @@ OperandMatchResultTy MSP430AsmParser::tryParseRegister(unsigned &RegNo,
bool MSP430AsmParser::parseJccInstruction(ParseInstructionInfo &Info,
StringRef Name, SMLoc NameLoc,
OperandVector &Operands) {
if (!Name.startswith_lower("j"))
if (!Name.startswith_insensitive("j"))
return true;
auto CC = Name.drop_front().lower();
@ -390,7 +390,7 @@ bool MSP430AsmParser::ParseInstruction(ParseInstructionInfo &Info,
StringRef Name, SMLoc NameLoc,
OperandVector &Operands) {
// Drop .w suffix
if (Name.endswith_lower(".w"))
if (Name.endswith_insensitive(".w"))
Name = Name.drop_back(2);
if (!parseJccInstruction(Info, Name, NameLoc, Operands))

View File

@ -1207,28 +1207,28 @@ bool PPCAsmParser::MatchRegisterName(unsigned &RegNo, int64_t &IntVal) {
return true;
StringRef Name = getParser().getTok().getString();
if (Name.equals_lower("lr")) {
if (Name.equals_insensitive("lr")) {
RegNo = isPPC64() ? PPC::LR8 : PPC::LR;
IntVal = 8;
} else if (Name.equals_lower("ctr")) {
} else if (Name.equals_insensitive("ctr")) {
RegNo = isPPC64() ? PPC::CTR8 : PPC::CTR;
IntVal = 9;
} else if (Name.equals_lower("vrsave")) {
} else if (Name.equals_insensitive("vrsave")) {
RegNo = PPC::VRSAVE;
IntVal = 256;
} else if (Name.startswith_lower("r") &&
} else if (Name.startswith_insensitive("r") &&
!Name.substr(1).getAsInteger(10, IntVal) && IntVal < 32) {
RegNo = isPPC64() ? XRegs[IntVal] : RRegs[IntVal];
} else if (Name.startswith_lower("f") &&
} else if (Name.startswith_insensitive("f") &&
!Name.substr(1).getAsInteger(10, IntVal) && IntVal < 32) {
RegNo = FRegs[IntVal];
} else if (Name.startswith_lower("vs") &&
} else if (Name.startswith_insensitive("vs") &&
!Name.substr(2).getAsInteger(10, IntVal) && IntVal < 64) {
RegNo = VSRegs[IntVal];
} else if (Name.startswith_lower("v") &&
} else if (Name.startswith_insensitive("v") &&
!Name.substr(1).getAsInteger(10, IntVal) && IntVal < 32) {
RegNo = VRegs[IntVal];
} else if (Name.startswith_lower("cr") &&
} else if (Name.startswith_insensitive("cr") &&
!Name.substr(2).getAsInteger(10, IntVal) && IntVal < 8) {
RegNo = CRRegs[IntVal];
} else

View File

@ -15772,7 +15772,7 @@ PPCTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
&PPC::G8RCRegClass);
// GCC accepts 'cc' as an alias for 'cr0', and we need to do the same.
if (!R.second && StringRef("{cc}").equals_lower(Constraint)) {
if (!R.second && StringRef("{cc}").equals_insensitive(Constraint)) {
R.first = PPC::CR0;
R.second = &PPC::CRRCRegClass;
}

View File

@ -371,7 +371,7 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo,
InlineAsm::ConstraintInfo &C = CIV[i];
if (C.Type != InlineAsm::isInput)
for (unsigned j = 0, je = C.Codes.size(); j < je; ++j)
if (StringRef(C.Codes[j]).equals_lower("{ctr}"))
if (StringRef(C.Codes[j]).equals_insensitive("{ctr}"))
return true;
}
return false;

View File

@ -1125,9 +1125,8 @@ bool SparcAsmParser::matchRegisterName(const AsmToken &Tok, unsigned &RegNo,
return true;
}
if (name.substr(0, 3).equals_lower("asr")
&& !name.substr(3).getAsInteger(10, intVal)
&& intVal > 0 && intVal < 32) {
if (name.substr(0, 3).equals_insensitive("asr") &&
!name.substr(3).getAsInteger(10, intVal) && intVal > 0 && intVal < 32) {
RegNo = ASRRegs[intVal];
RegKind = SparcOperand::rk_Special;
return true;
@ -1196,9 +1195,8 @@ bool SparcAsmParser::matchRegisterName(const AsmToken &Tok, unsigned &RegNo,
}
// %fcc0 - %fcc3
if (name.substr(0, 3).equals_lower("fcc")
&& !name.substr(3).getAsInteger(10, intVal)
&& intVal < 4) {
if (name.substr(0, 3).equals_insensitive("fcc") &&
!name.substr(3).getAsInteger(10, intVal) && intVal < 4) {
// FIXME: check 64bit and handle %fcc1 - %fcc3
RegNo = Sparc::FCC0 + intVal;
RegKind = SparcOperand::rk_Special;
@ -1206,46 +1204,42 @@ bool SparcAsmParser::matchRegisterName(const AsmToken &Tok, unsigned &RegNo,
}
// %g0 - %g7
if (name.substr(0, 1).equals_lower("g")
&& !name.substr(1).getAsInteger(10, intVal)
&& intVal < 8) {
if (name.substr(0, 1).equals_insensitive("g") &&
!name.substr(1).getAsInteger(10, intVal) && intVal < 8) {
RegNo = IntRegs[intVal];
RegKind = SparcOperand::rk_IntReg;
return true;
}
// %o0 - %o7
if (name.substr(0, 1).equals_lower("o")
&& !name.substr(1).getAsInteger(10, intVal)
&& intVal < 8) {
if (name.substr(0, 1).equals_insensitive("o") &&
!name.substr(1).getAsInteger(10, intVal) && intVal < 8) {
RegNo = IntRegs[8 + intVal];
RegKind = SparcOperand::rk_IntReg;
return true;
}
if (name.substr(0, 1).equals_lower("l")
&& !name.substr(1).getAsInteger(10, intVal)
&& intVal < 8) {
if (name.substr(0, 1).equals_insensitive("l") &&
!name.substr(1).getAsInteger(10, intVal) && intVal < 8) {
RegNo = IntRegs[16 + intVal];
RegKind = SparcOperand::rk_IntReg;
return true;
}
if (name.substr(0, 1).equals_lower("i")
&& !name.substr(1).getAsInteger(10, intVal)
&& intVal < 8) {
if (name.substr(0, 1).equals_insensitive("i") &&
!name.substr(1).getAsInteger(10, intVal) && intVal < 8) {
RegNo = IntRegs[24 + intVal];
RegKind = SparcOperand::rk_IntReg;
return true;
}
// %f0 - %f31
if (name.substr(0, 1).equals_lower("f")
&& !name.substr(1, 2).getAsInteger(10, intVal) && intVal < 32) {
if (name.substr(0, 1).equals_insensitive("f") &&
!name.substr(1, 2).getAsInteger(10, intVal) && intVal < 32) {
RegNo = FloatRegs[intVal];
RegKind = SparcOperand::rk_FloatReg;
return true;
}
// %f32 - %f62
if (name.substr(0, 1).equals_lower("f")
&& !name.substr(1, 2).getAsInteger(10, intVal)
&& intVal >= 32 && intVal <= 62 && (intVal % 2 == 0)) {
if (name.substr(0, 1).equals_insensitive("f") &&
!name.substr(1, 2).getAsInteger(10, intVal) && intVal >= 32 &&
intVal <= 62 && (intVal % 2 == 0)) {
// FIXME: Check V9
RegNo = DoubleRegs[intVal/2];
RegKind = SparcOperand::rk_DoubleReg;
@ -1253,17 +1247,16 @@ bool SparcAsmParser::matchRegisterName(const AsmToken &Tok, unsigned &RegNo,
}
// %r0 - %r31
if (name.substr(0, 1).equals_lower("r")
&& !name.substr(1, 2).getAsInteger(10, intVal) && intVal < 31) {
if (name.substr(0, 1).equals_insensitive("r") &&
!name.substr(1, 2).getAsInteger(10, intVal) && intVal < 31) {
RegNo = IntRegs[intVal];
RegKind = SparcOperand::rk_IntReg;
return true;
}
// %c0 - %c31
if (name.substr(0, 1).equals_lower("c")
&& !name.substr(1).getAsInteger(10, intVal)
&& intVal < 32) {
if (name.substr(0, 1).equals_insensitive("c") &&
!name.substr(1).getAsInteger(10, intVal) && intVal < 32) {
RegNo = CoprocRegs[intVal];
RegKind = SparcOperand::rk_CoprocReg;
return true;

View File

@ -87,7 +87,7 @@ bool DetectRoundChange::runOnMachineFunction(MachineFunction &MF) {
if (MO.isGlobal()) {
StringRef FuncName = MO.getGlobal()->getName();
if (FuncName.compare_lower("fesetround") == 0) {
if (FuncName.compare_insensitive("fesetround") == 0) {
errs() << "Error: You are using the detectroundchange "
"option to detect rounding changes that will "
"cause LEON errata. The only way to fix this "

View File

@ -391,9 +391,9 @@ public:
auto &Flt = Lexer.getTok();
auto S = Flt.getString();
double Val;
if (S.compare_lower("infinity") == 0) {
if (S.compare_insensitive("infinity") == 0) {
Val = std::numeric_limits<double>::infinity();
} else if (S.compare_lower("nan") == 0) {
} else if (S.compare_insensitive("nan") == 0) {
Val = std::numeric_limits<double>::quiet_NaN();
} else {
return true;

View File

@ -1784,21 +1784,21 @@ bool X86AsmParser::ParseIntelNamedOperator(StringRef Name,
if (Name.compare(Name.lower()) && Name.compare(Name.upper()) &&
!getParser().isParsingMasm())
return false;
if (Name.equals_lower("not")) {
if (Name.equals_insensitive("not")) {
SM.onNot();
} else if (Name.equals_lower("or")) {
} else if (Name.equals_insensitive("or")) {
SM.onOr();
} else if (Name.equals_lower("shl")) {
} else if (Name.equals_insensitive("shl")) {
SM.onLShift();
} else if (Name.equals_lower("shr")) {
} else if (Name.equals_insensitive("shr")) {
SM.onRShift();
} else if (Name.equals_lower("xor")) {
} else if (Name.equals_insensitive("xor")) {
SM.onXor();
} else if (Name.equals_lower("and")) {
} else if (Name.equals_insensitive("and")) {
SM.onAnd();
} else if (Name.equals_lower("mod")) {
} else if (Name.equals_insensitive("mod")) {
SM.onMod();
} else if (Name.equals_lower("offset")) {
} else if (Name.equals_insensitive("offset")) {
SMLoc OffsetLoc = getTok().getLoc();
const MCExpr *Val = nullptr;
StringRef ID;
@ -1814,24 +1814,24 @@ bool X86AsmParser::ParseIntelNamedOperator(StringRef Name,
} else {
return false;
}
if (!Name.equals_lower("offset"))
if (!Name.equals_insensitive("offset"))
End = consumeToken();
return true;
}
bool X86AsmParser::ParseMasmNamedOperator(StringRef Name,
IntelExprStateMachine &SM,
bool &ParseError, SMLoc &End) {
if (Name.equals_lower("eq")) {
if (Name.equals_insensitive("eq")) {
SM.onEq();
} else if (Name.equals_lower("ne")) {
} else if (Name.equals_insensitive("ne")) {
SM.onNE();
} else if (Name.equals_lower("lt")) {
} else if (Name.equals_insensitive("lt")) {
SM.onLT();
} else if (Name.equals_lower("le")) {
} else if (Name.equals_insensitive("le")) {
SM.onLE();
} else if (Name.equals_lower("gt")) {
} else if (Name.equals_insensitive("gt")) {
SM.onGT();
} else if (Name.equals_lower("ge")) {
} else if (Name.equals_insensitive("ge")) {
SM.onGE();
} else {
return false;
@ -1933,7 +1933,7 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
if (Parser.isParsingMasm()) {
const AsmToken &NextTok = getLexer().peekTok();
if (NextTok.is(AsmToken::Identifier) &&
NextTok.getIdentifier().equals_lower("ptr")) {
NextTok.getIdentifier().equals_insensitive("ptr")) {
AsmTypeInfo Info;
if (Parser.lookUpType(Identifier, Info))
return Error(Tok.getLoc(), "unknown type");
@ -3068,13 +3068,13 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
}
// Parse MASM style pseudo prefixes.
if (isParsingMSInlineAsm()) {
if (Name.equals_lower("vex"))
if (Name.equals_insensitive("vex"))
ForcedVEXEncoding = VEXEncoding_VEX;
else if (Name.equals_lower("vex2"))
else if (Name.equals_insensitive("vex2"))
ForcedVEXEncoding = VEXEncoding_VEX2;
else if (Name.equals_lower("vex3"))
else if (Name.equals_insensitive("vex3"))
ForcedVEXEncoding = VEXEncoding_VEX3;
else if (Name.equals_lower("evex"))
else if (Name.equals_insensitive("evex"))
ForcedVEXEncoding = VEXEncoding_EVEX;
if (ForcedVEXEncoding != VEXEncoding_Default) {
@ -3105,7 +3105,7 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
(PatchedName.startswith("j") &&
ParseConditionCode(PatchedName.substr(1)) != X86::COND_INVALID))) {
StringRef NextTok = Parser.getTok().getString();
if (Parser.isParsingMasm() ? NextTok.equals_lower("short")
if (Parser.isParsingMasm() ? NextTok.equals_insensitive("short")
: NextTok == "short") {
SMLoc NameEndLoc =
NameLoc.getFromPointer(NameLoc.getPointer() + Name.size());
@ -4649,19 +4649,19 @@ bool X86AsmParser::ParseDirective(AsmToken DirectiveID) {
else if (IDVal == ".cv_fpo_endproc")
return parseDirectiveFPOEndProc(DirectiveID.getLoc());
else if (IDVal == ".seh_pushreg" ||
(Parser.isParsingMasm() && IDVal.equals_lower(".pushreg")))
(Parser.isParsingMasm() && IDVal.equals_insensitive(".pushreg")))
return parseDirectiveSEHPushReg(DirectiveID.getLoc());
else if (IDVal == ".seh_setframe" ||
(Parser.isParsingMasm() && IDVal.equals_lower(".setframe")))
(Parser.isParsingMasm() && IDVal.equals_insensitive(".setframe")))
return parseDirectiveSEHSetFrame(DirectiveID.getLoc());
else if (IDVal == ".seh_savereg" ||
(Parser.isParsingMasm() && IDVal.equals_lower(".savereg")))
(Parser.isParsingMasm() && IDVal.equals_insensitive(".savereg")))
return parseDirectiveSEHSaveReg(DirectiveID.getLoc());
else if (IDVal == ".seh_savexmm" ||
(Parser.isParsingMasm() && IDVal.equals_lower(".savexmm128")))
(Parser.isParsingMasm() && IDVal.equals_insensitive(".savexmm128")))
return parseDirectiveSEHSaveXMM(DirectiveID.getLoc());
else if (IDVal == ".seh_pushframe" ||
(Parser.isParsingMasm() && IDVal.equals_lower(".pushframe")))
(Parser.isParsingMasm() && IDVal.equals_insensitive(".pushframe")))
return parseDirectiveSEHPushFrame(DirectiveID.getLoc());
return true;

View File

@ -332,7 +332,7 @@ static MCAsmInfo *createX86MCAsmInfo(const MCRegisterInfo &MRI,
MAI = new X86ELFMCAsmInfo(TheTriple);
} else if (TheTriple.isWindowsMSVCEnvironment() ||
TheTriple.isWindowsCoreCLREnvironment()) {
if (Options.getAssemblyLanguage().equals_lower("masm"))
if (Options.getAssemblyLanguage().equals_insensitive("masm"))
MAI = new X86MCAsmInfoMicrosoftMASM(TheTriple);
else
MAI = new X86MCAsmInfoMicrosoft(TheTriple);

View File

@ -52000,21 +52000,22 @@ X86TargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
}
// GCC allows "st(0)" to be called just plain "st".
if (StringRef("{st}").equals_lower(Constraint))
if (StringRef("{st}").equals_insensitive(Constraint))
return std::make_pair(X86::FP0, &X86::RFP80RegClass);
}
// flags -> EFLAGS
if (StringRef("{flags}").equals_lower(Constraint))
if (StringRef("{flags}").equals_insensitive(Constraint))
return std::make_pair(X86::EFLAGS, &X86::CCRRegClass);
// dirflag -> DF
// Only allow for clobber.
if (StringRef("{dirflag}").equals_lower(Constraint) && VT == MVT::Other)
if (StringRef("{dirflag}").equals_insensitive(Constraint) &&
VT == MVT::Other)
return std::make_pair(X86::DF, &X86::DFCCRRegClass);
// fpsr -> FPSW
if (StringRef("{fpsr}").equals_lower(Constraint))
if (StringRef("{fpsr}").equals_insensitive(Constraint))
return std::make_pair(X86::FPSW, &X86::FPCCRRegClass);
return Res;

View File

@ -99,10 +99,10 @@ Optional<std::string> getPrefix(StringRef Argv0) {
// llvm-dlltool -> None
// aarch64-w64-mingw32-llvm-dlltool-10.exe -> aarch64-w64-mingw32
ProgName = ProgName.rtrim("0123456789.-");
if (!ProgName.consume_back_lower("dlltool"))
if (!ProgName.consume_back_insensitive("dlltool"))
return None;
ProgName.consume_back_lower("llvm-");
ProgName.consume_back_lower("-");
ProgName.consume_back_insensitive("llvm-");
ProgName.consume_back_insensitive("-");
return ProgName.str();
}

View File

@ -607,12 +607,12 @@ AbstractInterpreter::createJIT(const char *Argv0, std::string &Message,
static bool IsARMArchitecture(std::vector<StringRef> Args) {
for (size_t I = 0; I < Args.size(); ++I) {
if (!Args[I].equals_lower("-arch"))
if (!Args[I].equals_insensitive("-arch"))
continue;
++I;
if (I == Args.size())
break;
if (Args[I].startswith_lower("arm"))
if (Args[I].startswith_insensitive("arm"))
return true;
}

View File

@ -126,9 +126,9 @@ MODIFIERS:
)";
static void printHelpMessage() {
if (Stem.contains_lower("ranlib"))
if (Stem.contains_insensitive("ranlib"))
outs() << RanlibHelp;
else if (Stem.contains_lower("ar"))
else if (Stem.contains_insensitive("ar"))
outs() << ArHelp;
}
@ -1276,7 +1276,7 @@ int main(int argc, char **argv) {
// Lib.exe -> lib (see D44808, MSBuild runs Lib.exe)
// dlltool.exe -> dlltool
// arm-pokymllib32-linux-gnueabi-llvm-ar-10 -> ar
auto I = Stem.rfind_lower(Tool);
auto I = Stem.rfind_insensitive(Tool);
return I != StringRef::npos &&
(I + Tool.size() == Stem.size() || !isAlnum(Stem[I + Tool.size()]));
};

View File

@ -60,7 +60,7 @@ int main(int argc, const char **argv) {
InitLLVM X(argc, argv);
// If argv[0] is or ends with 'gcov', always be gcov compatible
if (sys::path::stem(argv[0]).endswith_lower("gcov"))
if (sys::path::stem(argv[0]).endswith_insensitive("gcov"))
return gcovMain(argc, argv);
// Check if we are invoking a specific tool command.

View File

@ -479,12 +479,12 @@ Expected<uint64_t> getSlabAllocSize(StringRef SizeString) {
uint64_t Units = 1024;
if (SizeString.endswith_lower("kb"))
if (SizeString.endswith_insensitive("kb"))
SizeString = SizeString.drop_back(2).rtrim();
else if (SizeString.endswith_lower("mb")) {
else if (SizeString.endswith_insensitive("mb")) {
Units = 1024 * 1024;
SizeString = SizeString.drop_back(2).rtrim();
} else if (SizeString.endswith_lower("gb")) {
} else if (SizeString.endswith_insensitive("gb")) {
Units = 1024 * 1024 * 1024;
SizeString = SizeString.drop_back(2).rtrim();
}

View File

@ -81,7 +81,7 @@ static Expected<DriverConfig> getDriverConfig(ArrayRef<const char *> Args) {
// strip-10.exe -> strip
// powerpc64-unknown-freebsd13-objcopy -> objcopy
// llvm-install-name-tool -> install-name-tool
auto I = Stem.rfind_lower(Tool);
auto I = Stem.rfind_insensitive(Tool);
return I != StringRef::npos &&
(I + Tool.size() == Stem.size() || !isAlnum(Stem[I + Tool.size()]));
};

View File

@ -2527,7 +2527,7 @@ int main(int argc, char **argv) {
// llvm-objdump -> objdump
// llvm-otool-10.exe -> otool
// powerpc64-unknown-freebsd13-objdump -> objdump
auto I = Stem.rfind_lower(Tool);
auto I = Stem.rfind_insensitive(Tool);
return I != StringRef::npos &&
(I + Tool.size() == Stem.size() || !isAlnum(Stem[I + Tool.size()]));
};

View File

@ -350,13 +350,13 @@ static bool isMyCode(const SymbolGroup &Group) {
StringRef Name = Group.name();
if (Name.startswith("Import:"))
return false;
if (Name.endswith_lower(".dll"))
if (Name.endswith_insensitive(".dll"))
return false;
if (Name.equals_lower("* linker *"))
if (Name.equals_insensitive("* linker *"))
return false;
if (Name.startswith_lower("f:\\binaries\\Intermediate\\vctools"))
if (Name.startswith_insensitive("f:\\binaries\\Intermediate\\vctools"))
return false;
if (Name.startswith_lower("f:\\dd\\vctools\\crt"))
if (Name.startswith_insensitive("f:\\dd\\vctools\\crt"))
return false;
return true;
}

View File

@ -99,7 +99,7 @@ static bool stripQuotes(StringRef &Str, bool &IsLongString) {
return false;
// Just take the contents of the string, checking if it's been marked long.
IsLongString = Str.startswith_lower("L");
IsLongString = Str.startswith_insensitive("L");
if (IsLongString)
Str = Str.drop_front();

View File

@ -91,7 +91,7 @@ bool Filter::parseLine(StringRef Line) {
StringRef Ext = Line.rsplit('.').second;
if (Ext.equals_lower("h") || Ext.equals_lower("c")) {
if (Ext.equals_insensitive("h") || Ext.equals_insensitive("c")) {
Outputting = false;
} else {
Outputting = true;

View File

@ -215,7 +215,7 @@ Expected<IntWithNotMask> RCParser::parseIntExpr2() {
}
case Kind::Identifier: {
if (!read().value().equals_lower("not"))
if (!read().value().equals_insensitive("not"))
return getExpectedError(ErrorMsg, true);
ASSIGN_OR_RETURN(Result, parseIntExpr2());
return IntWithNotMask(0, (*Result).getValue());
@ -330,7 +330,7 @@ Expected<uint32_t> RCParser::parseFlags(ArrayRef<StringRef> FlagDesc,
bool FoundFlag = false;
for (size_t FlagId = 0; FlagId < FlagDesc.size(); ++FlagId) {
if (!FlagResult->equals_lower(FlagDesc[FlagId]))
if (!FlagResult->equals_insensitive(FlagDesc[FlagId]))
continue;
Result |= FlagValues[FlagId];
@ -351,23 +351,23 @@ uint16_t RCParser::parseMemoryFlags(uint16_t Flags) {
if (Token.kind() != Kind::Identifier)
return Flags;
const StringRef Ident = Token.value();
if (Ident.equals_lower("PRELOAD"))
if (Ident.equals_insensitive("PRELOAD"))
Flags |= MfPreload;
else if (Ident.equals_lower("LOADONCALL"))
else if (Ident.equals_insensitive("LOADONCALL"))
Flags &= ~MfPreload;
else if (Ident.equals_lower("FIXED"))
else if (Ident.equals_insensitive("FIXED"))
Flags &= ~(MfMoveable | MfDiscardable);
else if (Ident.equals_lower("MOVEABLE"))
else if (Ident.equals_insensitive("MOVEABLE"))
Flags |= MfMoveable;
else if (Ident.equals_lower("DISCARDABLE"))
else if (Ident.equals_insensitive("DISCARDABLE"))
Flags |= MfDiscardable | MfMoveable | MfPure;
else if (Ident.equals_lower("PURE"))
else if (Ident.equals_insensitive("PURE"))
Flags |= MfPure;
else if (Ident.equals_lower("IMPURE"))
else if (Ident.equals_insensitive("IMPURE"))
Flags &= ~(MfPure | MfDiscardable);
else if (Ident.equals_lower("SHARED"))
else if (Ident.equals_insensitive("SHARED"))
Flags |= MfPure;
else if (Ident.equals_lower("NONSHARED"))
else if (Ident.equals_insensitive("NONSHARED"))
Flags &= ~(MfPure | MfDiscardable);
else
return Flags;
@ -392,23 +392,23 @@ RCParser::parseOptionalStatements(OptStmtType StmtsType) {
Expected<std::unique_ptr<OptionalStmt>>
RCParser::parseSingleOptionalStatement(OptStmtType StmtsType) {
ASSIGN_OR_RETURN(TypeToken, readIdentifier());
if (TypeToken->equals_lower("CHARACTERISTICS"))
if (TypeToken->equals_insensitive("CHARACTERISTICS"))
return parseCharacteristicsStmt();
if (TypeToken->equals_lower("LANGUAGE"))
if (TypeToken->equals_insensitive("LANGUAGE"))
return parseLanguageStmt();
if (TypeToken->equals_lower("VERSION"))
if (TypeToken->equals_insensitive("VERSION"))
return parseVersionStmt();
if (StmtsType != OptStmtType::BasicStmt) {
if (TypeToken->equals_lower("CAPTION"))
if (TypeToken->equals_insensitive("CAPTION"))
return parseCaptionStmt();
if (TypeToken->equals_lower("CLASS"))
if (TypeToken->equals_insensitive("CLASS"))
return parseClassStmt();
if (TypeToken->equals_lower("EXSTYLE"))
if (TypeToken->equals_insensitive("EXSTYLE"))
return parseExStyleStmt();
if (TypeToken->equals_lower("FONT"))
if (TypeToken->equals_insensitive("FONT"))
return parseFontStmt(StmtsType);
if (TypeToken->equals_lower("STYLE"))
if (TypeToken->equals_insensitive("STYLE"))
return parseStyleStmt();
}
@ -635,15 +635,15 @@ Expected<MenuDefinitionList> RCParser::parseMenuItemsList() {
while (!consumeOptionalType(Kind::BlockEnd)) {
ASSIGN_OR_RETURN(ItemTypeResult, readIdentifier());
bool IsMenuItem = ItemTypeResult->equals_lower("MENUITEM");
bool IsPopup = ItemTypeResult->equals_lower("POPUP");
bool IsMenuItem = ItemTypeResult->equals_insensitive("MENUITEM");
bool IsPopup = ItemTypeResult->equals_insensitive("POPUP");
if (!IsMenuItem && !IsPopup)
return getExpectedError("MENUITEM, POPUP, END or '}'", true);
if (IsMenuItem && isNextTokenKind(Kind::Identifier)) {
// Now, expecting SEPARATOR.
ASSIGN_OR_RETURN(SeparatorResult, readIdentifier());
if (SeparatorResult->equals_lower("SEPARATOR")) {
if (SeparatorResult->equals_insensitive("SEPARATOR")) {
List.addDefinition(std::make_unique<MenuSeparator>());
continue;
}
@ -731,12 +731,12 @@ Expected<std::unique_ptr<VersionInfoStmt>> RCParser::parseVersionInfoStmt() {
// Expect either BLOCK or VALUE, then a name or a key (a string).
ASSIGN_OR_RETURN(TypeResult, readIdentifier());
if (TypeResult->equals_lower("BLOCK")) {
if (TypeResult->equals_insensitive("BLOCK")) {
ASSIGN_OR_RETURN(NameResult, readString());
return parseVersionInfoBlockContents(*NameResult);
}
if (TypeResult->equals_lower("VALUE")) {
if (TypeResult->equals_insensitive("VALUE")) {
ASSIGN_OR_RETURN(KeyResult, readString());
// Read a non-empty list of strings and/or ints, each
// possibly preceded by a comma. Unfortunately, the tool behavior depends

View File

@ -145,7 +145,7 @@ public:
: Data(Token), IsInt(Token.kind() == RCToken::Kind::Int) {}
bool equalsLower(const char *Str) {
return !IsInt && Data.String.equals_lower(Str);
return !IsInt && Data.String.equals_insensitive(Str);
}
bool isInt() const { return IsInt; }

View File

@ -350,9 +350,9 @@ void Tokenizer::processIdentifier(RCToken &Token) const {
assert(Token.kind() == Kind::Identifier);
StringRef Name = Token.value();
if (Name.equals_lower("begin"))
if (Name.equals_insensitive("begin"))
Token = RCToken(Kind::BlockBegin, Name);
else if (Name.equals_lower("end"))
else if (Name.equals_insensitive("end"))
Token = RCToken(Kind::BlockEnd, Name);
}

View File

@ -262,10 +262,10 @@ static std::pair<bool, std::string> isWindres(llvm::StringRef Argv0) {
// llvm-rc -> "", llvm-rc
// aarch64-w64-mingw32-llvm-windres-10.exe -> aarch64-w64-mingw32, llvm-windres
ProgName = ProgName.rtrim("0123456789.-");
if (!ProgName.consume_back_lower("windres"))
if (!ProgName.consume_back_insensitive("windres"))
return std::make_pair<bool, std::string>(false, "");
ProgName.consume_back_lower("llvm-");
ProgName.consume_back_lower("-");
ProgName.consume_back_insensitive("llvm-");
ProgName.consume_back_insensitive("-");
return std::make_pair<bool, std::string>(true, ProgName.str());
}

View File

@ -210,12 +210,12 @@ TEST_F(SmallStringTest, Comparisons) {
EXPECT_EQ( 1, SmallString<10>("aab").compare("aa"));
EXPECT_EQ( 1, SmallString<10>("\xFF").compare("\1"));
EXPECT_EQ(-1, SmallString<10>("AaB").compare_lower("aAd"));
EXPECT_EQ( 0, SmallString<10>("AaB").compare_lower("aab"));
EXPECT_EQ( 1, SmallString<10>("AaB").compare_lower("AAA"));
EXPECT_EQ(-1, SmallString<10>("AaB").compare_lower("aaBb"));
EXPECT_EQ( 1, SmallString<10>("AaB").compare_lower("aA"));
EXPECT_EQ( 1, SmallString<10>("\xFF").compare_lower("\1"));
EXPECT_EQ(-1, SmallString<10>("AaB").compare_insensitive("aAd"));
EXPECT_EQ( 0, SmallString<10>("AaB").compare_insensitive("aab"));
EXPECT_EQ( 1, SmallString<10>("AaB").compare_insensitive("AAA"));
EXPECT_EQ(-1, SmallString<10>("AaB").compare_insensitive("aaBb"));
EXPECT_EQ( 1, SmallString<10>("AaB").compare_insensitive("aA"));
EXPECT_EQ( 1, SmallString<10>("\xFF").compare_insensitive("\1"));
EXPECT_EQ(-1, SmallString<10>("aab").compare_numeric("aad"));
EXPECT_EQ( 0, SmallString<10>("aab").compare_numeric("aab"));

View File

@ -1122,8 +1122,8 @@ TEST(CommandLineTest, GetCommandLineArguments) {
EXPECT_EQ(llvm::sys::path::is_absolute(argv[0]),
llvm::sys::path::is_absolute(__argv[0]));
EXPECT_TRUE(llvm::sys::path::filename(argv[0])
.equals_lower("supporttests.exe"))
EXPECT_TRUE(
llvm::sys::path::filename(argv[0]).equals_insensitive("supporttests.exe"))
<< "Filename of test executable is "
<< llvm::sys::path::filename(argv[0]);
}

View File

@ -612,7 +612,7 @@ struct MatchableInfo {
/// operator< - Compare two matchables.
bool operator<(const MatchableInfo &RHS) const {
// The primary comparator is the instruction mnemonic.
if (int Cmp = Mnemonic.compare_lower(RHS.Mnemonic))
if (int Cmp = Mnemonic.compare_insensitive(RHS.Mnemonic))
return Cmp == -1;
if (AsmOperands.size() != RHS.AsmOperands.size())