From 9d14adb9f6e1910a59d134cfeef1fe5293939be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 23 Jun 2021 14:52:36 +0300 Subject: [PATCH] [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. --- include/llvm/ADT/SmallString.h | 10 +-- include/llvm/ADT/StringSwitch.h | 6 +- include/llvm/Support/FormatProviders.h | 2 +- include/llvm/Support/VirtualFileSystem.h | 2 +- lib/CodeGen/SelectionDAG/TargetLowering.cpp | 2 +- lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp | 2 +- lib/FileCheck/FileCheck.cpp | 2 +- lib/MC/MCParser/AsmParser.cpp | 5 +- lib/MC/MCParser/COFFMasmParser.cpp | 6 +- lib/MC/MCParser/MasmParser.cpp | 66 +++++++++---------- lib/Option/OptTable.cpp | 5 +- lib/ProfileData/InstrProfReader.cpp | 10 +-- lib/Support/StringExtras.cpp | 2 +- lib/Support/VirtualFileSystem.cpp | 9 +-- lib/Support/Windows/Path.inc | 2 +- lib/Target/AArch64/AArch64ISelLowering.cpp | 2 +- .../AArch64/AArch64MachineFunctionInfo.cpp | 12 ++-- .../AArch64/AsmParser/AArch64AsmParser.cpp | 13 ++-- lib/Target/AMDGPU/AMDGPULibCalls.cpp | 4 +- lib/Target/AMDGPU/AMDGPUSubtarget.cpp | 8 +-- lib/Target/ARM/ARMISelLowering.cpp | 2 +- lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 8 +-- .../Hexagon/AsmParser/HexagonAsmParser.cpp | 17 ++--- .../MCTargetDesc/HexagonMCDuplexInfo.cpp | 6 +- lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp | 4 +- .../MSP430/AsmParser/MSP430AsmParser.cpp | 4 +- lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp | 16 ++--- lib/Target/PowerPC/PPCISelLowering.cpp | 2 +- lib/Target/PowerPC/PPCTargetTransformInfo.cpp | 2 +- lib/Target/Sparc/AsmParser/SparcAsmParser.cpp | 49 ++++++-------- lib/Target/Sparc/LeonPasses.cpp | 2 +- .../AsmParser/WebAssemblyAsmParser.cpp | 4 +- lib/Target/X86/AsmParser/X86AsmParser.cpp | 52 +++++++-------- .../X86/MCTargetDesc/X86MCTargetDesc.cpp | 2 +- lib/Target/X86/X86ISelLowering.cpp | 9 +-- .../llvm-dlltool/DlltoolDriver.cpp | 6 +- tools/bugpoint/ToolRunner.cpp | 4 +- tools/llvm-ar/llvm-ar.cpp | 6 +- tools/llvm-cov/llvm-cov.cpp | 2 +- tools/llvm-jitlink/llvm-jitlink.cpp | 6 +- tools/llvm-objcopy/llvm-objcopy.cpp | 2 +- tools/llvm-objdump/llvm-objdump.cpp | 2 +- tools/llvm-pdbutil/DumpOutputStyle.cpp | 8 +-- tools/llvm-rc/ResourceFileWriter.cpp | 2 +- tools/llvm-rc/ResourceScriptCppFilter.cpp | 2 +- tools/llvm-rc/ResourceScriptParser.cpp | 48 +++++++------- tools/llvm-rc/ResourceScriptStmt.h | 2 +- tools/llvm-rc/ResourceScriptToken.cpp | 4 +- tools/llvm-rc/llvm-rc.cpp | 6 +- unittests/ADT/SmallStringTest.cpp | 12 ++-- unittests/Support/CommandLineTest.cpp | 4 +- utils/TableGen/AsmMatcherEmitter.cpp | 2 +- 52 files changed, 233 insertions(+), 234 deletions(-) diff --git a/include/llvm/ADT/SmallString.h b/include/llvm/ADT/SmallString.h index 5a56321ae49..56b0639b98c 100644 --- a/include/llvm/ADT/SmallString.h +++ b/include/llvm/ADT/SmallString.h @@ -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 diff --git a/include/llvm/ADT/StringSwitch.h b/include/llvm/ADT/StringSwitch.h index fea911f6928..726d67c8f24 100644 --- a/include/llvm/ADT/StringSwitch.h +++ b/include/llvm/ADT/StringSwitch.h @@ -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; diff --git a/include/llvm/Support/FormatProviders.h b/include/llvm/Support/FormatProviders.h index c31481a2925..3edd8844bc7 100644 --- a/include/llvm/Support/FormatProviders.h +++ b/include/llvm/Support/FormatProviders.h @@ -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-")) diff --git a/include/llvm/Support/VirtualFileSystem.h b/include/llvm/Support/VirtualFileSystem.h index d7abd1ff855..323e6719645 100644 --- a/include/llvm/Support/VirtualFileSystem.h +++ b/include/llvm/Support/VirtualFileSystem.h @@ -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 == "/"); } diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index c5a647508ba..801a994e7fd 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -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 S = std::make_pair(PR, RC); diff --git a/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp index ae91698b925..9084e689d16 100644 --- a/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp @@ -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() { diff --git a/lib/FileCheck/FileCheck.cpp b/lib/FileCheck/FileCheck.cpp index 950d236717d..04476d99933 100644 --- a/lib/FileCheck/FileCheck.cpp +++ b/lib/FileCheck/FileCheck.cpp @@ -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(); return MatchResult(Pos, /*MatchLen=*/FixedStr.size(), Error::success()); diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 17e845ddefc..5305dde360d 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -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"); diff --git a/lib/MC/MCParser/COFFMasmParser.cpp b/lib/MC/MCParser/COFFMasmParser.cpp index f745605b6b3..9da880f3b2e 100644 --- a/lib/MC/MCParser/COFFMasmParser.cpp +++ b/lib/MC/MCParser/COFFMasmParser.cpp @@ -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); diff --git a/lib/MC/MCParser/MasmParser.cpp b/lib/MC/MCParser/MasmParser.cpp index 77d61cd0cce..fa0236ea175 100644 --- a/lib/MC/MCParser/MasmParser.cpp +++ b/lib/MC/MCParser/MasmParser.cpp @@ -1133,8 +1133,8 @@ const AsmToken &MasmParser::Lex() { MutableArrayRef 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(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 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); diff --git a/lib/Option/OptTable.cpp b/lib/Option/OptTable.cpp index c78c2cee1ed..41bd440fe1a 100644 --- a/lib/Option/OptTable.cpp +++ b/lib/Option/OptTable.cpp @@ -184,9 +184,8 @@ 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) - : Rest.startswith(I->Name); + bool Matched = IgnoreCase ? Rest.startswith_insensitive(I->Name) + : Rest.startswith(I->Name); if (Matched) return Prefix.size() + StringRef(I->Name).size(); } diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index b83295a16f0..fa7610c4200 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -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); diff --git a/lib/Support/StringExtras.cpp b/lib/Support/StringExtras.cpp index c206bd21451..8abf9f7ce0f 100644 --- a/lib/Support/StringExtras.cpp +++ b/lib/Support/StringExtras.cpp @@ -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; } diff --git a/lib/Support/VirtualFileSystem.cpp b/lib/Support/VirtualFileSystem.cpp index dd820c15ca6..3f6c434f772 100644 --- a/lib/Support/VirtualFileSystem.cpp +++ b/lib/Support/VirtualFileSystem.cpp @@ -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; } diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index daa69bf04b4..c1d291731a8 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -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; } diff --git a/lib/Target/AArch64/AArch64ISelLowering.cpp b/lib/Target/AArch64/AArch64ISelLowering.cpp index cbe64b7e605..19196fbf7c3 100644 --- a/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -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 diff --git a/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp b/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp index 41343ba9700..6950675c5d5 100644 --- a/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp +++ b/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp @@ -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 { diff --git a/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index a7ec6214bb8..d2a0b1dcecb 100644 --- a/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -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); } diff --git a/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/lib/Target/AMDGPU/AMDGPULibCalls.cpp index 840abf4b18e..1ee6933bd7f 100644 --- a/lib/Target/AMDGPU/AMDGPULibCalls.cpp +++ b/lib/Target/AMDGPU/AMDGPULibCalls.cpp @@ -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(); diff --git a/lib/Target/AMDGPU/AMDGPUSubtarget.cpp b/lib/Target/AMDGPU/AMDGPUSubtarget.cpp index a4636518522..37480ffbf05 100644 --- a/lib/Target/AMDGPU/AMDGPUSubtarget.cpp +++ b/lib/Target/AMDGPU/AMDGPUSubtarget.cpp @@ -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,"; } diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index f3a0218fc04..23451af57b1 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -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); diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index dcd9ec3f7ae..abecc9cc0c8 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -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); } diff --git a/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp b/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp index 8047aa51bc2..7edc2a01eeb 100644 --- a/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp +++ b/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp @@ -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(Operand).getToken().equals_lower(String); + return static_cast(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)); diff --git a/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp b/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp index 5154a0a1e46..e1c95f1cc92 100644 --- a/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp +++ b/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp @@ -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)) { diff --git a/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp b/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp index 639ab24b081..e2642ddf722 100644 --- a/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp +++ b/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp @@ -754,9 +754,9 @@ std::unique_ptr 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 diff --git a/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp b/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp index f32418c5be5..4bad0368505 100644 --- a/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp +++ b/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp @@ -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)) diff --git a/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp b/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp index 04c22cbaeac..7631bb4bccf 100644 --- a/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp +++ b/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp @@ -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 diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index a04d77ad0a2..5cb4470e042 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -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; } diff --git a/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/lib/Target/PowerPC/PPCTargetTransformInfo.cpp index daf9b2b2035..d5a7873bd05 100644 --- a/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -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; diff --git a/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp b/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp index 7b02a245bf6..9a2df8ca7fe 100644 --- a/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp +++ b/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp @@ -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; diff --git a/lib/Target/Sparc/LeonPasses.cpp b/lib/Target/Sparc/LeonPasses.cpp index 6ad6940c6b5..fa05a41f312 100644 --- a/lib/Target/Sparc/LeonPasses.cpp +++ b/lib/Target/Sparc/LeonPasses.cpp @@ -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 " diff --git a/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp index 5003a843f35..6e9bfccabcf 100644 --- a/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp +++ b/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp @@ -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::infinity(); - } else if (S.compare_lower("nan") == 0) { + } else if (S.compare_insensitive("nan") == 0) { Val = std::numeric_limits::quiet_NaN(); } else { return true; diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index c25e8b3d2db..00d9d195fb5 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -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; diff --git a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp index 5cf8d77519d..12dc053cd97 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp @@ -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); diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 14e71929c32..4233c34ee4e 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -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; diff --git a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp index 56f6b5dff36..ed5f870b57e 100644 --- a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp +++ b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp @@ -99,10 +99,10 @@ Optional 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(); } diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index c4ea1dad122..b81ab07980d 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -607,12 +607,12 @@ AbstractInterpreter::createJIT(const char *Argv0, std::string &Message, static bool IsARMArchitecture(std::vector 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; } diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 4991e51a0f7..0e1dce6bc2e 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -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()])); }; diff --git a/tools/llvm-cov/llvm-cov.cpp b/tools/llvm-cov/llvm-cov.cpp index 172ec9f3ced..0e320c0965f 100644 --- a/tools/llvm-cov/llvm-cov.cpp +++ b/tools/llvm-cov/llvm-cov.cpp @@ -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. diff --git a/tools/llvm-jitlink/llvm-jitlink.cpp b/tools/llvm-jitlink/llvm-jitlink.cpp index 95e5cba58f7..99af0a48b35 100644 --- a/tools/llvm-jitlink/llvm-jitlink.cpp +++ b/tools/llvm-jitlink/llvm-jitlink.cpp @@ -479,12 +479,12 @@ Expected 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(); } diff --git a/tools/llvm-objcopy/llvm-objcopy.cpp b/tools/llvm-objcopy/llvm-objcopy.cpp index a4d5b534301..ad166487eb7 100644 --- a/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/tools/llvm-objcopy/llvm-objcopy.cpp @@ -81,7 +81,7 @@ static Expected getDriverConfig(ArrayRef 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()])); }; diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index bb02ed4490c..2f0e05e3d26 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -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()])); }; diff --git a/tools/llvm-pdbutil/DumpOutputStyle.cpp b/tools/llvm-pdbutil/DumpOutputStyle.cpp index babdb56a718..ef299ea9d48 100644 --- a/tools/llvm-pdbutil/DumpOutputStyle.cpp +++ b/tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -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; } diff --git a/tools/llvm-rc/ResourceFileWriter.cpp b/tools/llvm-rc/ResourceFileWriter.cpp index 0c922698f57..60287a37f0b 100644 --- a/tools/llvm-rc/ResourceFileWriter.cpp +++ b/tools/llvm-rc/ResourceFileWriter.cpp @@ -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(); diff --git a/tools/llvm-rc/ResourceScriptCppFilter.cpp b/tools/llvm-rc/ResourceScriptCppFilter.cpp index e610be99dfb..6657aa54cf6 100644 --- a/tools/llvm-rc/ResourceScriptCppFilter.cpp +++ b/tools/llvm-rc/ResourceScriptCppFilter.cpp @@ -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; diff --git a/tools/llvm-rc/ResourceScriptParser.cpp b/tools/llvm-rc/ResourceScriptParser.cpp index 5141ac0c386..fec49778387 100644 --- a/tools/llvm-rc/ResourceScriptParser.cpp +++ b/tools/llvm-rc/ResourceScriptParser.cpp @@ -215,7 +215,7 @@ Expected 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 RCParser::parseFlags(ArrayRef 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> 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 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()); continue; } @@ -731,12 +731,12 @@ Expected> 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 diff --git a/tools/llvm-rc/ResourceScriptStmt.h b/tools/llvm-rc/ResourceScriptStmt.h index 27fbea3ae8c..9f77d361a5f 100644 --- a/tools/llvm-rc/ResourceScriptStmt.h +++ b/tools/llvm-rc/ResourceScriptStmt.h @@ -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; } diff --git a/tools/llvm-rc/ResourceScriptToken.cpp b/tools/llvm-rc/ResourceScriptToken.cpp index 2e21f675b92..6ce75f7e4bb 100644 --- a/tools/llvm-rc/ResourceScriptToken.cpp +++ b/tools/llvm-rc/ResourceScriptToken.cpp @@ -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); } diff --git a/tools/llvm-rc/llvm-rc.cpp b/tools/llvm-rc/llvm-rc.cpp index 78cebd90b78..33d94c37ced 100644 --- a/tools/llvm-rc/llvm-rc.cpp +++ b/tools/llvm-rc/llvm-rc.cpp @@ -262,10 +262,10 @@ static std::pair 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(false, ""); - ProgName.consume_back_lower("llvm-"); - ProgName.consume_back_lower("-"); + ProgName.consume_back_insensitive("llvm-"); + ProgName.consume_back_insensitive("-"); return std::make_pair(true, ProgName.str()); } diff --git a/unittests/ADT/SmallStringTest.cpp b/unittests/ADT/SmallStringTest.cpp index 3401a8266a6..b207f582e91 100644 --- a/unittests/ADT/SmallStringTest.cpp +++ b/unittests/ADT/SmallStringTest.cpp @@ -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")); diff --git a/unittests/Support/CommandLineTest.cpp b/unittests/Support/CommandLineTest.cpp index bb6cc3959ed..57fae856acb 100644 --- a/unittests/Support/CommandLineTest.cpp +++ b/unittests/Support/CommandLineTest.cpp @@ -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]); } diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp index 4a543938acf..96159a60c66 100644 --- a/utils/TableGen/AsmMatcherEmitter.cpp +++ b/utils/TableGen/AsmMatcherEmitter.cpp @@ -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())