diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp --- a/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp @@ -150,11 +150,11 @@ unsigned EditDistance = 3; for (const auto &NameAndEnum : Mapping) { if (IgnoreCase) { - if (Value.equals_lower(NameAndEnum.second)) + if (Value.equals_insensitive(NameAndEnum.second)) return NameAndEnum.first; } else if (Value.equals(NameAndEnum.second)) { return NameAndEnum.first; - } else if (Value.equals_lower(NameAndEnum.second)) { + } else if (Value.equals_insensitive(NameAndEnum.second)) { Closest = NameAndEnum.second; EditDistance = 0; continue; diff --git a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp --- a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp +++ b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp @@ -70,9 +70,9 @@ bool KernelNameRestrictionPPCallbacks::fileNameIsRestricted( StringRef FileName) { - return FileName.equals_lower("kernel.cl") || - FileName.equals_lower("verilog.cl") || - FileName.equals_lower("vhdl.cl"); + return FileName.equals_insensitive("kernel.cl") || + FileName.equals_insensitive("verilog.cl") || + FileName.equals_insensitive("vhdl.cl"); } void KernelNameRestrictionPPCallbacks::EndOfMainFile() { diff --git a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp @@ -176,8 +176,8 @@ return InComment == InDecl; InComment = InComment.trim('_'); InDecl = InDecl.trim('_'); - // FIXME: compare_lower only works for ASCII. - return InComment.compare_lower(InDecl) == 0; + // FIXME: compare_insensitive only works for ASCII. + return InComment.compare_insensitive(InDecl) == 0; } static bool looksLikeExpectMethod(const CXXMethodDecl *Expect) { diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp @@ -159,7 +159,7 @@ if (S->getBeginLoc().isMacroID()) { StringRef MacroName = Lexer::getImmediateMacroName( S->getBeginLoc(), *Result.SourceManager, getLangOpts()); - if (MacroName.contains_lower("assert")) + if (MacroName.contains_insensitive("assert")) return; } if (isControlStatement(S)) diff --git a/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp b/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp --- a/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp @@ -104,8 +104,8 @@ StringRef FalseMacroName = Lexer::getImmediateMacroName(FalseLiteralLoc, SM, Opts); - if (FalseMacroName.compare_lower("false") == 0 || - FalseMacroName.compare_lower("null") == 0) + if (FalseMacroName.compare_insensitive("false") == 0 || + FalseMacroName.compare_insensitive("null") == 0) return; } diff --git a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp @@ -93,8 +93,8 @@ return L.empty() || R.empty() || L == R; // We allow two names if one is a prefix/suffix of the other, ignoring case. // Important special case: this is true if either parameter has no name! - return L.startswith_lower(R) || R.startswith_lower(L) || - L.endswith_lower(R) || R.endswith_lower(L); + return L.startswith_insensitive(R) || R.startswith_insensitive(L) || + L.endswith_insensitive(R) || R.endswith_insensitive(L); } DifferingParamsContainer diff --git a/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp b/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp @@ -93,7 +93,7 @@ // Else, find matching suffix, case-*insensitive*ly. auto NewSuffix = llvm::find_if( NewSuffixes, [OldSuffix](const std::string &PotentialNewSuffix) { - return OldSuffix.equals_lower(PotentialNewSuffix); + return OldSuffix.equals_insensitive(PotentialNewSuffix); }); // Have a match, return it. if (NewSuffix != NewSuffixes.end()) diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -1680,7 +1680,7 @@ C.SemaResult->Kind == CodeCompletionResult::RK_Macro) || (C.IndexResult && C.IndexResult->SymInfo.Kind == index::SymbolKind::Macro)) && - !C.Name.startswith_lower(Filter->pattern())) + !C.Name.startswith_insensitive(Filter->pattern())) return None; return Filter->match(C.Name); } diff --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp --- a/clang-tools-extra/clangd/CompileCommands.cpp +++ b/clang-tools-extra/clangd/CompileCommands.cpp @@ -296,9 +296,9 @@ DriverMode getDriverMode(const std::vector &Args) { DriverMode Mode = DM_GCC; llvm::StringRef Argv0 = Args.front(); - if (Argv0.endswith_lower(".exe")) + if (Argv0.endswith_insensitive(".exe")) Argv0 = Argv0.drop_back(strlen(".exe")); - if (Argv0.endswith_lower("cl")) + if (Argv0.endswith_insensitive("cl")) Mode = DM_CL; for (const llvm::StringRef Arg : Args) { if (Arg == "--driver-mode=cl") { diff --git a/clang-tools-extra/clangd/ConfigYAML.cpp b/clang-tools-extra/clangd/ConfigYAML.cpp --- a/clang-tools-extra/clangd/ConfigYAML.cpp +++ b/clang-tools-extra/clangd/ConfigYAML.cpp @@ -169,7 +169,7 @@ void parse(Fragment::IndexBlock::ExternalBlock &F, Located ExternalVal) { - if (!llvm::StringRef(*ExternalVal).equals_lower("none")) { + if (!llvm::StringRef(*ExternalVal).equals_insensitive("none")) { error("Only scalar value supported for External is 'None'", ExternalVal.Range); return; diff --git a/clang-tools-extra/clangd/HeaderSourceSwitch.cpp b/clang-tools-extra/clangd/HeaderSourceSwitch.cpp --- a/clang-tools-extra/clangd/HeaderSourceSwitch.cpp +++ b/clang-tools-extra/clangd/HeaderSourceSwitch.cpp @@ -27,13 +27,13 @@ // Lookup in a list of known extensions. auto SourceIter = llvm::find_if(SourceExtensions, [&PathExt](PathRef SourceExt) { - return SourceExt.equals_lower(PathExt); + return SourceExt.equals_insensitive(PathExt); }); bool IsSource = SourceIter != std::end(SourceExtensions); auto HeaderIter = llvm::find_if(HeaderExtensions, [&PathExt](PathRef HeaderExt) { - return HeaderExt.equals_lower(PathExt); + return HeaderExt.equals_insensitive(PathExt); }); bool IsHeader = HeaderIter != std::end(HeaderExtensions); diff --git a/clang-tools-extra/clangd/InlayHints.cpp b/clang-tools-extra/clangd/InlayHints.cpp --- a/clang-tools-extra/clangd/InlayHints.cpp +++ b/clang-tools-extra/clangd/InlayHints.cpp @@ -156,7 +156,7 @@ return false; StringRef Name = getSimpleName(*Callee); - if (!Name.startswith_lower("set")) + if (!Name.startswith_insensitive("set")) return false; // In addition to checking that the function has one parameter and its @@ -168,10 +168,10 @@ // This currently doesn't handle cases where params use snake_case // and functions don't, e.g. // void setExceptionHandler(EHFunc exception_handler); - // We could improve this by replacing `equals_lower` with some + // We could improve this by replacing `equals_insensitive` with some // `sloppy_equals` which ignores case and also skips underscores. StringRef WhatItIsSetting = Name.substr(3).ltrim("_"); - return WhatItIsSetting.equals_lower(ParamNames[0]); + return WhatItIsSetting.equals_insensitive(ParamNames[0]); } bool shouldHint(const Expr *Arg, StringRef ParamName) { diff --git a/clang-tools-extra/clangd/Quality.cpp b/clang-tools-extra/clangd/Quality.cpp --- a/clang-tools-extra/clangd/Quality.cpp +++ b/clang-tools-extra/clangd/Quality.cpp @@ -378,7 +378,7 @@ wordMatching(llvm::StringRef Name, const llvm::StringSet<> *ContextWords) { if (ContextWords) for (const auto &Word : ContextWords->keys()) - if (Name.contains_lower(Word)) + if (Name.contains_insensitive(Word)) return Word; return llvm::None; } @@ -552,7 +552,7 @@ int NumMatch = 0; if (Relevance.ContextWords) { for (const auto &Word : Relevance.ContextWords->keys()) { - if (Relevance.Name.contains_lower(Word)) { + if (Relevance.Name.contains_insensitive(Word)) { ++NumMatch; } } diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -285,7 +285,7 @@ Line = Line.ltrim(); if (!Line.startswith("error")) return false; - return Line.contains_lower("includ"); // Matches "include" or "including". + return Line.contains_insensitive("includ"); // Matches "include" or "including". } // Heuristically headers that only want to be included via an umbrella. diff --git a/clang-tools-extra/clangd/support/Path.cpp b/clang-tools-extra/clangd/support/Path.cpp --- a/clang-tools-extra/clangd/support/Path.cpp +++ b/clang-tools-extra/clangd/support/Path.cpp @@ -13,7 +13,7 @@ #ifdef CLANGD_PATH_CASE_INSENSITIVE std::string maybeCaseFoldPath(PathRef Path) { return Path.lower(); } -bool pathEqual(PathRef A, PathRef B) { return A.equals_lower(B); } +bool pathEqual(PathRef A, PathRef B) { return A.equals_insensitive(B); } #else // NOT CLANGD_PATH_CASE_INSENSITIVE std::string maybeCaseFoldPath(PathRef Path) { return Path.str(); } bool pathEqual(PathRef A, PathRef B) { return A == B; } diff --git a/clang-tools-extra/modularize/ModularizeUtilities.cpp b/clang-tools-extra/modularize/ModularizeUtilities.cpp --- a/clang-tools-extra/modularize/ModularizeUtilities.cpp +++ b/clang-tools-extra/modularize/ModularizeUtilities.cpp @@ -470,9 +470,9 @@ StringRef Extension = llvm::sys::path::extension(FileName); if (Extension.size() == 0) return true; - if (Extension.equals_lower(".h")) + if (Extension.equals_insensitive(".h")) return true; - if (Extension.equals_lower(".inc")) + if (Extension.equals_insensitive(".inc")) return true; return false; } diff --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp --- a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp +++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp @@ -20,7 +20,7 @@ ++MaxEditDistance; llvm::StringRef Res; for (const llvm::StringRef &Item : Allowed) { - if (Item.equals_lower(Search)) { + if (Item.equals_insensitive(Search)) { assert(!Item.equals(Search) && "This should be handled earlier on."); MaxEditDistance = 1; Res = Item; @@ -40,7 +40,7 @@ auto NoPrefix = Item; if (!NoPrefix.consume_front(DropPrefix)) continue; - if (NoPrefix.equals_lower(Search)) { + if (NoPrefix.equals_insensitive(Search)) { if (NoPrefix.equals(Search)) return Item.str(); MaxEditDistance = 1; diff --git a/clang/lib/Analysis/CalledOnceCheck.cpp b/clang/lib/Analysis/CalledOnceCheck.cpp --- a/clang/lib/Analysis/CalledOnceCheck.cpp +++ b/clang/lib/Analysis/CalledOnceCheck.cpp @@ -478,7 +478,7 @@ return llvm::any_of( CONVENTIONAL_CONDITIONS, [ConditionName](const llvm::StringLiteral &Conventional) { - return ConditionName.contains_lower(Conventional); + return ConditionName.contains_insensitive(Conventional); }); }); } diff --git a/clang/lib/Analysis/RetainSummaryManager.cpp b/clang/lib/Analysis/RetainSummaryManager.cpp --- a/clang/lib/Analysis/RetainSummaryManager.cpp +++ b/clang/lib/Analysis/RetainSummaryManager.cpp @@ -189,20 +189,20 @@ } static bool isRetain(const FunctionDecl *FD, StringRef FName) { - return FName.startswith_lower("retain") || FName.endswith_lower("retain"); + return FName.startswith_insensitive("retain") || FName.endswith_insensitive("retain"); } static bool isRelease(const FunctionDecl *FD, StringRef FName) { - return FName.startswith_lower("release") || FName.endswith_lower("release"); + return FName.startswith_insensitive("release") || FName.endswith_insensitive("release"); } static bool isAutorelease(const FunctionDecl *FD, StringRef FName) { - return FName.startswith_lower("autorelease") || - FName.endswith_lower("autorelease"); + return FName.startswith_insensitive("autorelease") || + FName.endswith_insensitive("autorelease"); } static bool isMakeCollectable(StringRef FName) { - return FName.contains_lower("MakeCollectable"); + return FName.contains_insensitive("MakeCollectable"); } /// A function is OSObject related if it is declared on a subclass @@ -1100,7 +1100,7 @@ if (S.isKeywordSelector()) { for (unsigned i = 0, e = S.getNumArgs(); i != e; ++i) { StringRef Slot = S.getNameForSlot(i); - if (Slot.substr(Slot.size() - 8).equals_lower("delegate")) { + if (Slot.substr(Slot.size() - 8).equals_insensitive("delegate")) { if (ResultEff == ObjCInitRetE) ResultEff = RetEffect::MakeNoRetHard(); else diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -128,7 +128,7 @@ // Stat("C:") does not recognize "C:" as a valid directory std::string DirNameStr; if (DirName.size() > 1 && DirName.back() == ':' && - DirName.equals_lower(llvm::sys::path::root_name(DirName))) { + DirName.equals_insensitive(llvm::sys::path::root_name(DirName))) { DirNameStr = DirName.str() + '.'; DirName = DirNameStr; } diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -2610,7 +2610,7 @@ bool Quote = (Lib.find(' ') != StringRef::npos); std::string ArgStr = Quote ? "\"" : ""; ArgStr += Lib; - if (!Lib.endswith_lower(".lib") && !Lib.endswith_lower(".a")) + if (!Lib.endswith_insensitive(".lib") && !Lib.endswith_insensitive(".a")) ArgStr += ".lib"; ArgStr += Quote ? "\"" : ""; return ArgStr; diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -591,9 +591,9 @@ A = Args.getLastArg(options::OPT_march_EQ); if (A && Target.isRISCV()) { StringRef ArchName = A->getValue(); - if (ArchName.startswith_lower("rv32")) + if (ArchName.startswith_insensitive("rv32")) Target.setArch(llvm::Triple::riscv32); - else if (ArchName.startswith_lower("rv64")) + else if (ArchName.startswith_insensitive("rv64")) Target.setArch(llvm::Triple::riscv64); } @@ -1755,7 +1755,7 @@ // case-insensitive sorting for consistency with the -help option // which prints out options in the case-insensitive alphabetical order. llvm::sort(SuggestedCompletions, [](StringRef A, StringRef B) { - if (int X = A.compare_lower(B)) + if (int X = A.compare_insensitive(B)) return X < 0; return A.compare(B) > 0; }); @@ -3585,7 +3585,7 @@ if (Args.hasArg(options::OPT_emit_llvm)) Diag(clang::diag::err_drv_emit_llvm_link); if (IsCLMode() && LTOMode != LTOK_None && - !Args.getLastArgValue(options::OPT_fuse_ld_EQ).equals_lower("lld")) + !Args.getLastArgValue(options::OPT_fuse_ld_EQ).equals_insensitive("lld")) Diag(clang::diag::err_drv_lto_without_lld); } @@ -5346,7 +5346,7 @@ case llvm::Triple::MSVC: case llvm::Triple::UnknownEnvironment: if (Args.getLastArgValue(options::OPT_fuse_ld_EQ) - .startswith_lower("bfd")) + .startswith_insensitive("bfd")) TC = std::make_unique( *this, Target, Args); else diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -610,17 +610,17 @@ // rv64* -> lp64 StringRef MArch = getRISCVArch(Args, Triple); - if (MArch.startswith_lower("rv32")) { + if (MArch.startswith_insensitive("rv32")) { // FIXME: parse `March` to find `D` extension properly - if (MArch.substr(4).contains_lower("d") || MArch.startswith_lower("rv32g")) + if (MArch.substr(4).contains_insensitive("d") || MArch.startswith_insensitive("rv32g")) return "ilp32d"; - else if (MArch.startswith_lower("rv32e")) + else if (MArch.startswith_insensitive("rv32e")) return "ilp32e"; else return "ilp32"; - } else if (MArch.startswith_lower("rv64")) { + } else if (MArch.startswith_insensitive("rv64")) { // FIXME: parse `March` to find `D` extension properly - if (MArch.substr(4).contains_lower("d") || MArch.startswith_lower("rv64g")) + if (MArch.substr(4).contains_insensitive("d") || MArch.startswith_insensitive("rv64g")) return "lp64d"; else return "lp64"; @@ -696,11 +696,11 @@ if (const Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) { StringRef MABI = A->getValue(); - if (MABI.equals_lower("ilp32e")) + if (MABI.equals_insensitive("ilp32e")) return "rv32e"; - else if (MABI.startswith_lower("ilp32")) + else if (MABI.startswith_insensitive("ilp32")) return "rv32imafdc"; - else if (MABI.startswith_lower("lp64")) + else if (MABI.startswith_insensitive("lp64")) return "rv64imafdc"; } diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2049,7 +2049,7 @@ D.Diag(diag::warn_drv_unsupported_sdata); } } else if (Args.getLastArgValue(options::OPT_mcmodel_EQ) - .equals_lower("large") && + .equals_insensitive("large") && (Triple.getArch() == llvm::Triple::riscv64)) { // Not support linker relaxation for RV64 with large code model. SmallDataLimit = "0"; @@ -6317,7 +6317,7 @@ // -finput_charset=UTF-8 is default. Reject others if (Arg *inputCharset = Args.getLastArg(options::OPT_finput_charset_EQ)) { StringRef value = inputCharset->getValue(); - if (!value.equals_lower("utf-8")) + if (!value.equals_insensitive("utf-8")) D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args) << value; } @@ -6325,7 +6325,7 @@ // -fexec_charset=UTF-8 is default. Reject others if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) { StringRef value = execCharset->getValue(); - if (!value.equals_lower("utf-8")) + if (!value.equals_insensitive("utf-8")) D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args) << value; } @@ -7252,17 +7252,17 @@ StringRef GuardArgs = A->getValue(); // The only valid options are "cf", "cf,nochecks", "cf-", "ehcont" and // "ehcont-". - if (GuardArgs.equals_lower("cf")) { + if (GuardArgs.equals_insensitive("cf")) { // Emit CFG instrumentation and the table of address-taken functions. CmdArgs.push_back("-cfguard"); - } else if (GuardArgs.equals_lower("cf,nochecks")) { + } else if (GuardArgs.equals_insensitive("cf,nochecks")) { // Emit only the table of address-taken functions. CmdArgs.push_back("-cfguard-no-checks"); - } else if (GuardArgs.equals_lower("ehcont")) { + } else if (GuardArgs.equals_insensitive("ehcont")) { // Emit EH continuation table. CmdArgs.push_back("-ehcontguard"); - } else if (GuardArgs.equals_lower("cf-") || - GuardArgs.equals_lower("ehcont-")) { + } else if (GuardArgs.equals_insensitive("cf-") || + GuardArgs.equals_insensitive("ehcont-")) { // Do nothing, but we might want to emit a security warning in future. } else { D.Diag(diag::err_drv_invalid_value) << A->getSpelling() << GuardArgs; diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp --- a/clang/lib/Driver/ToolChains/Fuchsia.cpp +++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp @@ -54,8 +54,8 @@ CmdArgs.push_back("now"); const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); - if (llvm::sys::path::filename(Exec).equals_lower("ld.lld") || - llvm::sys::path::stem(Exec).equals_lower("ld.lld")) { + if (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") || + llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")) { CmdArgs.push_back("-z"); CmdArgs.push_back("rodynamic"); CmdArgs.push_back("-z"); diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -51,9 +51,9 @@ ArgStringList &CmdArgs) { if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) { StringRef CPUArg(A->getValue()); - if (CPUArg.equals_lower("krait")) + if (CPUArg.equals_insensitive("krait")) CmdArgs.push_back("-mcpu=cortex-a15"); - else if(CPUArg.equals_lower("kryo")) + else if(CPUArg.equals_insensitive("kryo")) CmdArgs.push_back("-mcpu=cortex-a57"); else Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ); diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -38,7 +38,7 @@ // Handle the unsupported values passed to mhvx-length. if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_length_EQ)) { StringRef Val = A->getValue(); - if (!Val.equals_lower("64b") && !Val.equals_lower("128b")) + if (!Val.equals_insensitive("64b") && !Val.equals_insensitive("128b")) D.Diag(diag::err_drv_unsupported_option_argument) << A->getOption().getName() << Val; } @@ -218,8 +218,8 @@ bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs); bool UseG0 = false; const char *Exec = Args.MakeArgString(HTC.GetLinkerPath()); - bool UseLLD = (llvm::sys::path::filename(Exec).equals_lower("ld.lld") || - llvm::sys::path::stem(Exec).equals_lower("ld.lld")); + bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") || + llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")); bool UseShared = IsShared && !IsStatic; StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp --- a/clang/lib/Driver/ToolChains/MSVC.cpp +++ b/clang/lib/Driver/ToolChains/MSVC.cpp @@ -181,24 +181,24 @@ // whatever/VC/bin --> old toolchain, VC dir is toolchain dir. llvm::StringRef TestPath = PathEntry; - bool IsBin = llvm::sys::path::filename(TestPath).equals_lower("bin"); + bool IsBin = llvm::sys::path::filename(TestPath).equals_insensitive("bin"); if (!IsBin) { // Strip any architecture subdir like "amd64". TestPath = llvm::sys::path::parent_path(TestPath); - IsBin = llvm::sys::path::filename(TestPath).equals_lower("bin"); + IsBin = llvm::sys::path::filename(TestPath).equals_insensitive("bin"); } if (IsBin) { llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath); llvm::StringRef ParentFilename = llvm::sys::path::filename(ParentPath); - if (ParentFilename.equals_lower("VC")) { + if (ParentFilename.equals_insensitive("VC")) { Path = std::string(ParentPath); VSLayout = MSVCToolChain::ToolsetLayout::OlderVS; return true; } - if (ParentFilename.equals_lower("x86ret") || - ParentFilename.equals_lower("x86chk") || - ParentFilename.equals_lower("amd64ret") || - ParentFilename.equals_lower("amd64chk")) { + if (ParentFilename.equals_insensitive("x86ret") || + ParentFilename.equals_insensitive("x86chk") || + ParentFilename.equals_insensitive("amd64ret") || + ParentFilename.equals_insensitive("amd64chk")) { Path = std::string(ParentPath); VSLayout = MSVCToolChain::ToolsetLayout::DevDivInternal; return true; @@ -217,7 +217,7 @@ for (llvm::StringRef Prefix : ExpectedPrefixes) { if (It == End) goto NotAToolChain; - if (!It->startswith_lower(Prefix)) + if (!It->startswith_insensitive(Prefix)) goto NotAToolChain; ++It; } @@ -507,14 +507,14 @@ // Control Flow Guard checks if (Arg *A = Args.getLastArg(options::OPT__SLASH_guard)) { StringRef GuardArgs = A->getValue(); - if (GuardArgs.equals_lower("cf") || GuardArgs.equals_lower("cf,nochecks")) { + if (GuardArgs.equals_insensitive("cf") || GuardArgs.equals_insensitive("cf,nochecks")) { // MSVC doesn't yet support the "nochecks" modifier. CmdArgs.push_back("-guard:cf"); - } else if (GuardArgs.equals_lower("cf-")) { + } else if (GuardArgs.equals_insensitive("cf-")) { CmdArgs.push_back("-guard:cf-"); - } else if (GuardArgs.equals_lower("ehcont")) { + } else if (GuardArgs.equals_insensitive("ehcont")) { CmdArgs.push_back("-guard:ehcont"); - } else if (GuardArgs.equals_lower("ehcont-")) { + } else if (GuardArgs.equals_insensitive("ehcont-")) { CmdArgs.push_back("-guard:ehcont-"); } } @@ -584,10 +584,10 @@ = Args.getLastArgValue(options::OPT_fuse_ld_EQ, CLANG_DEFAULT_LINKER); if (Linker.empty()) Linker = "link"; - if (Linker.equals_lower("lld")) + if (Linker.equals_insensitive("lld")) Linker = "lld-link"; - if (Linker.equals_lower("link")) { + if (Linker.equals_insensitive("link")) { // If we're using the MSVC linker, it's not sufficient to just use link // from the program PATH, because other environments like GnuWin32 install // their own link.exe which may come first. @@ -646,7 +646,7 @@ // find it. for (const char *Cursor = EnvBlock.data(); *Cursor != '\0';) { llvm::StringRef EnvVar(Cursor); - if (EnvVar.startswith_lower("path=")) { + if (EnvVar.startswith_insensitive("path=")) { using SubDirectoryType = toolchains::MSVCToolChain::SubDirectoryType; constexpr size_t PrefixLen = 5; // strlen("path=") Environment.push_back(Args.MakeArgString( diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -427,7 +427,7 @@ NativeLLVMSupport = Args.getLastArgValue(options::OPT_fuse_ld_EQ, CLANG_DEFAULT_LINKER) - .equals_lower("lld"); + .equals_insensitive("lld"); } bool toolchains::MinGW::IsIntegratedAssemblerDefault() const { return true; } diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1429,23 +1429,23 @@ bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language, FormatStyle *Style) { - if (Name.equals_lower("llvm")) { + if (Name.equals_insensitive("llvm")) { *Style = getLLVMStyle(Language); - } else if (Name.equals_lower("chromium")) { + } else if (Name.equals_insensitive("chromium")) { *Style = getChromiumStyle(Language); - } else if (Name.equals_lower("mozilla")) { + } else if (Name.equals_insensitive("mozilla")) { *Style = getMozillaStyle(); - } else if (Name.equals_lower("google")) { + } else if (Name.equals_insensitive("google")) { *Style = getGoogleStyle(Language); - } else if (Name.equals_lower("webkit")) { + } else if (Name.equals_insensitive("webkit")) { *Style = getWebKitStyle(); - } else if (Name.equals_lower("gnu")) { + } else if (Name.equals_insensitive("gnu")) { *Style = getGNUStyle(); - } else if (Name.equals_lower("microsoft")) { + } else if (Name.equals_insensitive("microsoft")) { *Style = getMicrosoftStyle(Language); - } else if (Name.equals_lower("none")) { + } else if (Name.equals_insensitive("none")) { *Style = getNoStyle(); - } else if (Name.equals_lower("inheritparentconfig")) { + } else if (Name.equals_insensitive("inheritparentconfig")) { Style->InheritsParentConfig = true; } else { return false; @@ -2959,22 +2959,22 @@ static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) { if (FileName.endswith(".java")) return FormatStyle::LK_Java; - if (FileName.endswith_lower(".js") || FileName.endswith_lower(".mjs") || - FileName.endswith_lower(".ts")) + if (FileName.endswith_insensitive(".js") || FileName.endswith_insensitive(".mjs") || + FileName.endswith_insensitive(".ts")) return FormatStyle::LK_JavaScript; // (module) JavaScript or TypeScript. if (FileName.endswith(".m") || FileName.endswith(".mm")) return FormatStyle::LK_ObjC; - if (FileName.endswith_lower(".proto") || - FileName.endswith_lower(".protodevel")) + if (FileName.endswith_insensitive(".proto") || + FileName.endswith_insensitive(".protodevel")) return FormatStyle::LK_Proto; - if (FileName.endswith_lower(".textpb") || - FileName.endswith_lower(".pb.txt") || - FileName.endswith_lower(".textproto") || - FileName.endswith_lower(".asciipb")) + if (FileName.endswith_insensitive(".textpb") || + FileName.endswith_insensitive(".pb.txt") || + FileName.endswith_insensitive(".textproto") || + FileName.endswith_insensitive(".asciipb")) return FormatStyle::LK_TextProto; - if (FileName.endswith_lower(".td")) + if (FileName.endswith_insensitive(".td")) return FormatStyle::LK_TableGen; - if (FileName.endswith_lower(".cs")) + if (FileName.endswith_insensitive(".cs")) return FormatStyle::LK_CSharp; return FormatStyle::LK_Cpp; } @@ -3034,7 +3034,7 @@ // If the style inherits the parent configuration it is a command line // configuration, which wants to inherit, so we have to skip the check of the // StyleName. - if (!Style.InheritsParentConfig && !StyleName.equals_lower("file")) { + if (!Style.InheritsParentConfig && !StyleName.equals_insensitive("file")) { if (!getPredefinedStyle(StyleName, Style.Language, &Style)) return make_string_error("Invalid value for -style"); if (!Style.InheritsParentConfig) diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp --- a/clang/lib/Format/SortJavaScriptImports.cpp +++ b/clang/lib/Format/SortJavaScriptImports.cpp @@ -113,7 +113,7 @@ // Empty URLs sort *last* (for export {...};). if (LHS.URL.empty() != RHS.URL.empty()) return LHS.URL.empty() < RHS.URL.empty(); - if (int Res = LHS.URL.compare_lower(RHS.URL)) + if (int Res = LHS.URL.compare_insensitive(RHS.URL)) return Res < 0; // '*' imports (with prefix) sort before {a, b, ...} imports. if (LHS.Prefix.empty() != RHS.Prefix.empty()) @@ -327,7 +327,7 @@ SmallVector Symbols = Reference.Symbols; llvm::stable_sort( Symbols, [&](const JsImportedSymbol &LHS, const JsImportedSymbol &RHS) { - return LHS.Symbol.compare_lower(RHS.Symbol) < 0; + return LHS.Symbol.compare_insensitive(RHS.Symbol) < 0; }); if (!Reference.SymbolsMerged && Symbols == Reference.Symbols) { // Symbols didn't change, just emit the entire module reference. diff --git a/clang/lib/Format/UsingDeclarationsSorter.cpp b/clang/lib/Format/UsingDeclarationsSorter.cpp --- a/clang/lib/Format/UsingDeclarationsSorter.cpp +++ b/clang/lib/Format/UsingDeclarationsSorter.cpp @@ -48,7 +48,7 @@ return -1; // Two names within a group compare case-insensitively. - return NamesA[I].compare_lower(NamesB[I]); + return NamesA[I].compare_insensitive(NamesB[I]); } // I is the last index of NamesB and NamesB[I] is a non-namespace name. @@ -57,7 +57,7 @@ return 1; // Two namespaces names within a group compare case-insensitively. - int C = NamesA[I].compare_lower(NamesB[I]); + int C = NamesA[I].compare_insensitive(NamesB[I]); if (C != 0) return C; } diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3986,13 +3986,13 @@ if (Arg *A = Args.getLastArg(OPT_msign_return_address_EQ)) { StringRef SignScope = A->getValue(); - if (SignScope.equals_lower("none")) + if (SignScope.equals_insensitive("none")) Opts.setSignReturnAddressScope( LangOptions::SignReturnAddressScopeKind::None); - else if (SignScope.equals_lower("all")) + else if (SignScope.equals_insensitive("all")) Opts.setSignReturnAddressScope( LangOptions::SignReturnAddressScopeKind::All); - else if (SignScope.equals_lower("non-leaf")) + else if (SignScope.equals_insensitive("non-leaf")) Opts.setSignReturnAddressScope( LangOptions::SignReturnAddressScopeKind::NonLeaf); else @@ -4002,10 +4002,10 @@ if (Arg *A = Args.getLastArg(OPT_msign_return_address_key_EQ)) { StringRef SignKey = A->getValue(); if (!SignScope.empty() && !SignKey.empty()) { - if (SignKey.equals_lower("a_key")) + if (SignKey.equals_insensitive("a_key")) Opts.setSignReturnAddressKey( LangOptions::SignReturnAddressKeyKind::AKey); - else if (SignKey.equals_lower("b_key")) + else if (SignKey.equals_insensitive("b_key")) Opts.setSignReturnAddressKey( LangOptions::SignReturnAddressKeyKind::BKey); else diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp --- a/clang/lib/Lex/HeaderMap.cpp +++ b/clang/lib/Lex/HeaderMap.cpp @@ -224,7 +224,7 @@ Optional Key = getString(B.Key); if (LLVM_UNLIKELY(!Key)) continue; - if (!Filename.equals_lower(*Key)) + if (!Filename.equals_insensitive(*Key)) continue; // If so, we have a match in the hash table. Construct the destination diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -196,7 +196,7 @@ static bool warnByDefaultOnWrongCase(StringRef Include) { // If the first component of the path is "boost", treat this like a standard header // for the purposes of diagnostics. - if (::llvm::sys::path::begin(Include)->equals_lower("boost")) + if (::llvm::sys::path::begin(Include)->equals_insensitive("boost")) return true; // "condition_variable" is the longest standard header name at 18 characters. @@ -1723,7 +1723,7 @@ // If these path components differ by more than just case, then we // may be looking at symlinked paths. Bail on this diagnostic to avoid // noisy false positives. - SuggestReplacement = RealPathComponentIter->equals_lower(Component); + SuggestReplacement = RealPathComponentIter->equals_insensitive(Component); if (!SuggestReplacement) break; Component = *RealPathComponentIter; diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -1430,7 +1430,7 @@ StringRef VendorName = TI.getTriple().getVendorName(); if (VendorName.empty()) VendorName = "unknown"; - return VendorName.equals_lower(II->getName()); + return VendorName.equals_insensitive(II->getName()); } /// Implements the __is_target_os builtin macro. diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp @@ -755,7 +755,7 @@ std::string XSaved, YSaved; StringRef XStr = X.getOrderedName(XSaved); StringRef YStr = Y.getOrderedName(YSaved); - int cmp = XStr.compare_lower(YStr); + int cmp = XStr.compare_insensitive(YStr); if (cmp) return cmp < 0; diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6971,18 +6971,18 @@ bool ValidString = true; if (IsARMBuiltin) { - ValidString &= Fields[0].startswith_lower("cp") || - Fields[0].startswith_lower("p"); + ValidString &= Fields[0].startswith_insensitive("cp") || + Fields[0].startswith_insensitive("p"); if (ValidString) Fields[0] = - Fields[0].drop_front(Fields[0].startswith_lower("cp") ? 2 : 1); + Fields[0].drop_front(Fields[0].startswith_insensitive("cp") ? 2 : 1); - ValidString &= Fields[2].startswith_lower("c"); + ValidString &= Fields[2].startswith_insensitive("c"); if (ValidString) Fields[2] = Fields[2].drop_front(1); if (FiveFields) { - ValidString &= Fields[3].startswith_lower("c"); + ValidString &= Fields[3].startswith_insensitive("c"); if (ValidString) Fields[3] = Fields[3].drop_front(1); } diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -9491,10 +9491,10 @@ // Only files that really look like headers. (Except in system dirs). if (!IsSystem) { // Header extensions from Types.def, which we can't depend on here. - if (!(Filename.endswith_lower(".h") || - Filename.endswith_lower(".hh") || - Filename.endswith_lower(".hpp") || - Filename.endswith_lower(".inc"))) + if (!(Filename.endswith_insensitive(".h") || + Filename.endswith_insensitive(".hh") || + Filename.endswith_insensitive(".hpp") || + Filename.endswith_insensitive(".inc"))) break; } AddCompletion(Filename, /*IsDirectory=*/false); diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -2039,7 +2039,7 @@ RightStrRef = RightStrRef.substr(0, s2Term); // Use StringRef's comparison methods to compute the actual result. - int compareRes = IgnoreCase ? LeftStrRef.compare_lower(RightStrRef) + int compareRes = IgnoreCase ? LeftStrRef.compare_insensitive(RightStrRef) : LeftStrRef.compare(RightStrRef); // The strcmp function returns an integer greater than, equal to, or less diff --git a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp --- a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp @@ -763,14 +763,14 @@ const auto *IdInfo = Func->getIdentifier(); if (!IdInfo) return false; - return IdInfo->getName().endswith_lower("begin"); + return IdInfo->getName().endswith_insensitive("begin"); } bool isEndCall(const FunctionDecl *Func) { const auto *IdInfo = Func->getIdentifier(); if (!IdInfo) return false; - return IdInfo->getName().endswith_lower("end"); + return IdInfo->getName().endswith_insensitive("end"); } const CXXRecordDecl *getCXXRecordDecl(ProgramStateRef State, diff --git a/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp @@ -80,7 +80,7 @@ if (const auto *CD = dyn_cast(OD->getParent())) { std::string ContainerName = CD->getNameAsString(); StringRef CN(ContainerName); - if (CN.contains_lower("test") || CN.contains_lower("mock")) + if (CN.contains_insensitive("test") || CN.contains_insensitive("mock")) return true; } } diff --git a/clang/lib/StaticAnalyzer/Checkers/Iterator.cpp b/clang/lib/StaticAnalyzer/Checkers/Iterator.cpp --- a/clang/lib/StaticAnalyzer/Checkers/Iterator.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/Iterator.cpp @@ -29,8 +29,8 @@ return false; const auto Name = CRD->getName(); - if (!(Name.endswith_lower("iterator") || Name.endswith_lower("iter") || - Name.endswith_lower("it"))) + if (!(Name.endswith_insensitive("iterator") || Name.endswith_insensitive("iter") || + Name.endswith_insensitive("it"))) return false; bool HasCopyCtor = false, HasCopyAssign = true, HasDtor = false, diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -3145,9 +3145,9 @@ static bool isReferenceCountingPointerDestructor(const CXXDestructorDecl *DD) { if (const IdentifierInfo *II = DD->getParent()->getIdentifier()) { StringRef N = II->getName(); - if (N.contains_lower("ptr") || N.contains_lower("pointer")) { - if (N.contains_lower("ref") || N.contains_lower("cnt") || - N.contains_lower("intrusive") || N.contains_lower("shared")) { + if (N.contains_insensitive("ptr") || N.contains_insensitive("pointer")) { + if (N.contains_insensitive("ref") || N.contains_insensitive("cnt") || + N.contains_insensitive("intrusive") || N.contains_insensitive("shared")) { return true; } } diff --git a/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp b/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp --- a/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp +++ b/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp @@ -252,9 +252,9 @@ // 1) foo.h => bar.cc // 2) foo.proto.h => foo.cc StringRef Matching; - if (MatchingFileStem.startswith_lower(HeaderStem)) + if (MatchingFileStem.startswith_insensitive(HeaderStem)) Matching = MatchingFileStem; // example 1), 2) - else if (FileStem.equals_lower(HeaderStem)) + else if (FileStem.equals_insensitive(HeaderStem)) Matching = FileStem; // example 3) if (!Matching.empty()) { llvm::Regex MainIncludeRegex(HeaderStem.str() + Style.IncludeIsMainRegex, diff --git a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp --- a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp +++ b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp @@ -256,7 +256,7 @@ // Otherwise just check the clang executable file name. return !CmdLine.empty() && - llvm::sys::path::stem(CmdLine.front()).endswith_lower("cl"); + llvm::sys::path::stem(CmdLine.front()).endswith_insensitive("cl"); } // Map the language from the --std flag to that of the -x flag. diff --git a/clang/tools/clang-refactor/TestSupport.cpp b/clang/tools/clang-refactor/TestSupport.cpp --- a/clang/tools/clang-refactor/TestSupport.cpp +++ b/clang/tools/clang-refactor/TestSupport.cpp @@ -328,8 +328,8 @@ // Try to detect mistyped 'range:' comments to ensure tests don't miss // anything. auto DetectMistypedCommand = [&]() -> bool { - if (Comment.contains_lower("range") && Comment.contains("=") && - !Comment.contains_lower("run") && !Comment.contains("CHECK")) { + if (Comment.contains_insensitive("range") && Comment.contains("=") && + !Comment.contains_insensitive("run") && !Comment.contains("CHECK")) { llvm::errs() << "error: suspicious comment '" << Comment << "' that " "resembles the range command found\n"; diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -465,7 +465,7 @@ auto FlagsEnd = llvm::find(Args, "--"); if (FlagsEnd != Args.begin()) { ClangCLMode = - llvm::sys::path::stem(Args[0]).contains_lower("clang-cl") || + llvm::sys::path::stem(Args[0]).contains_insensitive("clang-cl") || llvm::is_contained(Args, "--driver-mode=cl"); // Reverse scan, starting at the end or at the element before "--". diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -273,7 +273,7 @@ // If the clang binary happens to be named cl.exe for compatibility reasons, // use clang-cl.exe as the prefix to avoid confusion between clang and MSVC. StringRef ExeBasename(llvm::sys::path::stem(Path)); - if (ExeBasename.equals_lower("cl")) + if (ExeBasename.equals_insensitive("cl")) ExeBasename = "clang-cl"; DiagClient->setPrefix(std::string(ExeBasename)); } diff --git a/clang/tools/libclang/CIndexCodeCompletion.cpp b/clang/tools/libclang/CIndexCodeCompletion.cpp --- a/clang/tools/libclang/CIndexCodeCompletion.cpp +++ b/clang/tools/libclang/CIndexCodeCompletion.cpp @@ -1026,7 +1026,7 @@ if (XText.empty() || YText.empty()) return !XText.empty(); - int result = XText.compare_lower(YText); + int result = XText.compare_insensitive(YText); if (result < 0) return true; if (result > 0) diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -210,7 +210,7 @@ struct FakeComparator : public PathComparator { ~FakeComparator() override {} bool equivalent(StringRef FileA, StringRef FileB) const override { - return FileA.equals_lower(FileB); + return FileA.equals_insensitive(FileB); } }; diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -464,7 +464,7 @@ static bool equalsPath(StringRef path1, StringRef path2) { #if defined(_WIN32) - return path1.equals_lower(path2); + return path1.equals_insensitive(path2); #else return path1.equals(path2); #endif diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -234,7 +234,7 @@ error(filename + ": is not a native COFF file. Recompile without /GL"); break; case file_magic::pecoff_executable: - if (filename.endswith_lower(".dll")) { + if (filename.endswith_insensitive(".dll")) { error(filename + ": bad file type. Did you specify a DLL instead of an " "import library?"); break; @@ -474,7 +474,7 @@ return None; } - if (path.endswith_lower(".lib")) + if (path.endswith_insensitive(".lib")) visitedLibs.insert(std::string(sys::path::filename(path))); return path; } @@ -1142,9 +1142,9 @@ // text between first and second % as variable name. buf.append(altPath.substr(cursor, firstMark - cursor)); StringRef var = altPath.substr(firstMark, secondMark - firstMark + 1); - if (var.equals_lower("%_pdb%")) + if (var.equals_insensitive("%_pdb%")) buf.append(pdbBasename); - else if (var.equals_lower("%_ext%")) + else if (var.equals_insensitive("%_ext%")) buf.append(binaryExtension); else { warn("only %_PDB% and %_EXT% supported in /pdbaltpath:, keeping " + @@ -1272,8 +1272,8 @@ // If the first command line argument is "/lib", link.exe acts like lib.exe. // We call our own implementation of lib.exe that understands bitcode files. - if (argsArr.size() > 1 && (StringRef(argsArr[1]).equals_lower("/lib") || - StringRef(argsArr[1]).equals_lower("-lib"))) { + if (argsArr.size() > 1 && (StringRef(argsArr[1]).equals_insensitive("/lib") || + StringRef(argsArr[1]).equals_insensitive("-lib"))) { if (llvm::libDriverMain(argsArr.slice(1)) != 0) fatal("lib failed"); return; diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -99,17 +99,17 @@ SmallVector splitArgs; fullArg.split(splitArgs, ","); for (StringRef arg : splitArgs) { - if (arg.equals_lower("no")) + if (arg.equals_insensitive("no")) config->guardCF = GuardCFLevel::Off; - else if (arg.equals_lower("nolongjmp")) + else if (arg.equals_insensitive("nolongjmp")) config->guardCF &= ~GuardCFLevel::LongJmp; - else if (arg.equals_lower("noehcont")) + else if (arg.equals_insensitive("noehcont")) config->guardCF &= ~GuardCFLevel::EHCont; - else if (arg.equals_lower("cf")) + else if (arg.equals_insensitive("cf")) config->guardCF = GuardCFLevel::CF; - else if (arg.equals_lower("longjmp")) + else if (arg.equals_insensitive("longjmp")) config->guardCF |= GuardCFLevel::CF | GuardCFLevel::LongJmp; - else if (arg.equals_lower("ehcont")) + else if (arg.equals_insensitive("ehcont")) config->guardCF |= GuardCFLevel::CF | GuardCFLevel::EHCont; else fatal("invalid argument to /guard: " + arg); @@ -257,17 +257,17 @@ // Parses a string in the form of "EMBED[,=]|NO". // Results are directly written to Config. void parseManifest(StringRef arg) { - if (arg.equals_lower("no")) { + if (arg.equals_insensitive("no")) { config->manifest = Configuration::No; return; } - if (!arg.startswith_lower("embed")) + if (!arg.startswith_insensitive("embed")) fatal("invalid option " + arg); config->manifest = Configuration::Embed; arg = arg.substr(strlen("embed")); if (arg.empty()) return; - if (!arg.startswith_lower(",id=")) + if (!arg.startswith_insensitive(",id=")) fatal("invalid option " + arg); arg = arg.substr(strlen(",id=")); if (arg.getAsInteger(0, config->manifestID)) @@ -277,7 +277,7 @@ // Parses a string in the form of "level=|uiAccess=|NO". // Results are directly written to Config. void parseManifestUAC(StringRef arg) { - if (arg.equals_lower("no")) { + if (arg.equals_insensitive("no")) { config->manifestUAC = false; return; } @@ -285,12 +285,12 @@ arg = arg.ltrim(); if (arg.empty()) return; - if (arg.startswith_lower("level=")) { + if (arg.startswith_insensitive("level=")) { arg = arg.substr(strlen("level=")); std::tie(config->manifestLevel, arg) = arg.split(" "); continue; } - if (arg.startswith_lower("uiaccess=")) { + if (arg.startswith_insensitive("uiaccess=")) { arg = arg.substr(strlen("uiaccess=")); std::tie(config->manifestUIAccess, arg) = arg.split(" "); continue; @@ -305,9 +305,9 @@ do { StringRef swaprun, newArg; std::tie(swaprun, newArg) = arg.split(','); - if (swaprun.equals_lower("cd")) + if (swaprun.equals_insensitive("cd")) config->swaprunCD = true; - else if (swaprun.equals_lower("net")) + else if (swaprun.equals_insensitive("net")) config->swaprunNet = true; else if (swaprun.empty()) error("/swaprun: missing argument"); @@ -560,21 +560,21 @@ while (!rest.empty()) { StringRef tok; std::tie(tok, rest) = rest.split(","); - if (tok.equals_lower("noname")) { + if (tok.equals_insensitive("noname")) { if (e.ordinal == 0) goto err; e.noname = true; continue; } - if (tok.equals_lower("data")) { + if (tok.equals_insensitive("data")) { e.data = true; continue; } - if (tok.equals_lower("constant")) { + if (tok.equals_insensitive("constant")) { e.constant = true; continue; } - if (tok.equals_lower("private")) { + if (tok.equals_insensitive("private")) { e.isPrivate = true; continue; } @@ -883,10 +883,10 @@ SmallVector tokens; cl::TokenizeWindowsCommandLineNoCopy(s, saver, tokens); for (StringRef tok : tokens) { - if (tok.startswith_lower("/export:") || tok.startswith_lower("-export:")) + if (tok.startswith_insensitive("/export:") || tok.startswith_insensitive("-export:")) result.exports.push_back(tok.substr(strlen("/export:"))); - else if (tok.startswith_lower("/include:") || - tok.startswith_lower("-include:")) + else if (tok.startswith_insensitive("/include:") || + tok.startswith_insensitive("-include:")) result.includes.push_back(tok.substr(strlen("/include:"))); else { // Copy substrings that are not valid C strings. The tokenizer may have diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp --- a/lld/Common/Args.cpp +++ b/lld/Common/Args.cpp @@ -89,7 +89,7 @@ } StringRef lld::args::getFilenameWithoutExe(StringRef path) { - if (path.endswith_lower(".exe")) + if (path.endswith_insensitive(".exe")) return sys::path::stem(path); return sys::path::filename(path); } diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -820,10 +820,10 @@ // Case mismatch, e.g. Foo vs FOO. for (auto &it : map) - if (name.equals_lower(it.first)) + if (name.equals_insensitive(it.first)) return it.second; for (Symbol *sym : symtab->symbols()) - if (!sym->isUndefined() && name.equals_lower(sym->getName())) + if (!sym->isUndefined() && name.equals_insensitive(sym->getName())) return sym; // The reference may be a mangled name while the definition is not. Suggest a diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -1126,24 +1126,24 @@ static Optional parseInt(StringRef tok) { // Hexadecimal uint64_t val; - if (tok.startswith_lower("0x")) { + if (tok.startswith_insensitive("0x")) { if (!to_integer(tok.substr(2), val, 16)) return None; return val; } - if (tok.endswith_lower("H")) { + if (tok.endswith_insensitive("H")) { if (!to_integer(tok.drop_back(), val, 16)) return None; return val; } // Decimal - if (tok.endswith_lower("K")) { + if (tok.endswith_insensitive("K")) { if (!to_integer(tok.drop_back(), val, 10)) return None; return val * 1024; } - if (tok.endswith_lower("M")) { + if (tok.endswith_insensitive("M")) { if (!to_integer(tok.drop_back(), val, 10)) return None; return val * 1024 * 1024; diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -401,7 +401,7 @@ for (auto *a : args) { switch (a->getOption().getID()) { case OPT_INPUT: - if (StringRef(a->getValue()).endswith_lower(".def")) + if (StringRef(a->getValue()).endswith_insensitive(".def")) add("-def:" + StringRef(a->getValue())); else add(prefix + StringRef(a->getValue())); diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp --- a/lld/lib/Driver/DarwinLdDriver.cpp +++ b/lld/lib/Driver/DarwinLdDriver.cpp @@ -293,7 +293,7 @@ /// Parse number assuming it is base 16, but allow 0x prefix. static bool parseNumberBase16(StringRef numStr, uint64_t &baseAddress) { - if (numStr.startswith_lower("0x")) + if (numStr.startswith_insensitive("0x")) numStr = numStr.drop_front(2); return numStr.getAsInteger(16, baseAddress); } diff --git a/lld/tools/lld/lld.cpp b/lld/tools/lld/lld.cpp --- a/lld/tools/lld/lld.cpp +++ b/lld/tools/lld/lld.cpp @@ -131,7 +131,7 @@ // Deduct the flavor from argv[0]. StringRef arg0 = path::filename(v[0]); - if (arg0.endswith_lower(".exe")) + if (arg0.endswith_insensitive(".exe")) arg0 = arg0.drop_back(4); return parseProgname(arg0); } diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -98,7 +98,7 @@ return result.Succeeded(); } - if (sub_command.equals_lower("help")) { + if (sub_command.equals_insensitive("help")) { this->CommandObject::GenerateHelpText(result); return result.Succeeded(); } diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -60,8 +60,8 @@ for (uint32_t reg = start_idx; reg < num_registers; ++reg) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg); - if (reg_name.equals_lower(reg_info->name) || - reg_name.equals_lower(reg_info->alt_name)) + if (reg_name.equals_insensitive(reg_info->name) || + reg_name.equals_insensitive(reg_info->alt_name)) return reg_info; } return nullptr; diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -86,7 +86,7 @@ const char *hide_console_var = getenv("LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE"); if (hide_console_var && - llvm::StringRef(hide_console_var).equals_lower("true")) { + llvm::StringRef(hide_console_var).equals_insensitive("true")) { startupinfo.dwFlags |= STARTF_USESHOWWINDOW; startupinfo.wShowWindow = SW_HIDE; } diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -96,7 +96,7 @@ #if defined(_WIN32) const char *disable_crash_dialog_var = getenv("LLDB_DISABLE_CRASH_DIALOG"); if (disable_crash_dialog_var && - llvm::StringRef(disable_crash_dialog_var).equals_lower("true")) { + llvm::StringRef(disable_crash_dialog_var).equals_insensitive("true")) { // This will prevent Windows from displaying a dialog box requiring user // interaction when // LLDB crashes. This is mostly useful when automating LLDB, for example diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2675,7 +2675,7 @@ const bool search_long_help = false; const bool search_syntax = false; const bool search_options = false; - if (command_name.contains_lower(search_word) || + if (command_name.contains_insensitive(search_word) || cmd_obj->HelpTextContainsWord(search_word, search_short_help, search_long_help, search_syntax, search_options)) { diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -316,11 +316,11 @@ llvm::StringRef long_help = GetHelpLong(); llvm::StringRef syntax_help = GetSyntax(); - if (search_short_help && short_help.contains_lower(search_word)) + if (search_short_help && short_help.contains_insensitive(search_word)) found_word = true; - else if (search_long_help && long_help.contains_lower(search_word)) + else if (search_long_help && long_help.contains_insensitive(search_word)) found_word = true; - else if (search_syntax && syntax_help.contains_lower(search_word)) + else if (search_syntax && syntax_help.contains_insensitive(search_word)) found_word = true; if (!found_word && search_options && GetOptions() != nullptr) { @@ -330,7 +330,7 @@ GetCommandInterpreter().GetDebugger().GetTerminalWidth()); if (!usage_help.Empty()) { llvm::StringRef usage_text = usage_help.GetString(); - if (usage_text.contains_lower(search_word)) + if (usage_text.contains_insensitive(search_word)) found_word = true; } } diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp --- a/lldb/source/Interpreter/OptionArgParser.cpp +++ b/lldb/source/Interpreter/OptionArgParser.cpp @@ -20,11 +20,11 @@ if (success_ptr) *success_ptr = true; ref = ref.trim(); - if (ref.equals_lower("false") || ref.equals_lower("off") || - ref.equals_lower("no") || ref.equals_lower("0")) { + if (ref.equals_insensitive("false") || ref.equals_insensitive("off") || + ref.equals_insensitive("no") || ref.equals_insensitive("0")) { return false; - } else if (ref.equals_lower("true") || ref.equals_lower("on") || - ref.equals_lower("yes") || ref.equals_lower("1")) { + } else if (ref.equals_insensitive("true") || ref.equals_insensitive("on") || + ref.equals_insensitive("yes") || ref.equals_insensitive("1")) { return true; } if (success_ptr) @@ -125,13 +125,13 @@ if (success_ptr) *success_ptr = true; - if (s.equals_lower("python")) + if (s.equals_insensitive("python")) return eScriptLanguagePython; - if (s.equals_lower("lua")) + if (s.equals_insensitive("lua")) return eScriptLanguageLua; - if (s.equals_lower("default")) + if (s.equals_insensitive("default")) return eScriptLanguageDefault; - if (s.equals_lower("none")) + if (s.equals_insensitive("none")) return eScriptLanguageNone; if (success_ptr) diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -630,11 +630,11 @@ } else { bool match = false; llvm::StringRef name = property->GetName(); - if (name.contains_lower(keyword)) + if (name.contains_insensitive(keyword)) match = true; else { llvm::StringRef desc = property->GetDescription(); - if (desc.contains_lower(keyword)) + if (desc.contains_insensitive(keyword)) match = true; } if (match) { diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp --- a/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -85,11 +85,11 @@ lldb::ScriptLanguage ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) { - if (language.equals_lower(LanguageToString(eScriptLanguageNone))) + if (language.equals_insensitive(LanguageToString(eScriptLanguageNone))) return eScriptLanguageNone; - if (language.equals_lower(LanguageToString(eScriptLanguagePython))) + if (language.equals_insensitive(LanguageToString(eScriptLanguagePython))) return eScriptLanguagePython; - if (language.equals_lower(LanguageToString(eScriptLanguageLua))) + if (language.equals_insensitive(LanguageToString(eScriptLanguageLua))) return eScriptLanguageLua; return eScriptLanguageUnknown; } diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1152,7 +1152,7 @@ const auto suffixes = {".cpp", ".cxx", ".c++", ".cc", ".c", ".h", ".hh", ".hpp", ".hxx", ".h++"}; for (auto suffix : suffixes) { - if (file_path.endswith_lower(suffix)) + if (file_path.endswith_insensitive(suffix)) return true; } diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -1126,7 +1126,7 @@ bool ObjCLanguage::IsSourceFile(llvm::StringRef file_path) const { const auto suffixes = {".h", ".m", ".M"}; for (auto suffix : suffixes) { - if (file_path.endswith_lower(suffix)) + if (file_path.endswith_insensitive(suffix)) return true; } return false; diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -19,7 +19,7 @@ bool ObjCPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const { const auto suffixes = {".h", ".mm"}; for (auto suffix : suffixes) { - if (file_path.endswith_lower(suffix)) + if (file_path.endswith_insensitive(suffix)) return true; } return false; diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -86,10 +86,10 @@ static bool ShouldUseLLDBServer() { llvm::StringRef use_lldb_server = ::getenv("LLDB_USE_LLDB_SERVER"); - return use_lldb_server.equals_lower("on") || - use_lldb_server.equals_lower("yes") || - use_lldb_server.equals_lower("1") || - use_lldb_server.equals_lower("true"); + return use_lldb_server.equals_insensitive("on") || + use_lldb_server.equals_insensitive("yes") || + use_lldb_server.equals_insensitive("1") || + use_lldb_server.equals_insensitive("true"); } void ProcessWindows::Initialize() { diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -548,7 +548,7 @@ // check if the process is wow64 - a 32 bit windows process running on a // 64 bit windows - if (llvm::StringRef(name).endswith_lower("wow64.dll")) { + if (llvm::StringRef(name).endswith_insensitive("wow64.dll")) { m_is_wow64 = true; } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp @@ -43,7 +43,7 @@ llvm::SmallString<64> normalized(other); llvm::sys::path::native(normalized); - return main.equals_lower(normalized); + return main.equals_insensitive(normalized); } static void ParseCompile3(const CVSymbol &sym, CompilandIndexItem &cci) { diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp @@ -41,7 +41,7 @@ auto it = llvm::find_if( register_names, [®_name](const llvm::EnumEntry ®ister_entry) { - return reg_name.compare_lower(register_entry.Name) == 0; + return reg_name.compare_insensitive(register_entry.Name) == 0; }); if (it == register_names.end()) diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -84,8 +84,8 @@ static bool ShouldUseNativeReader() { #if defined(_WIN32) llvm::StringRef use_native = ::getenv("LLDB_USE_NATIVE_PDB_READER"); - return use_native.equals_lower("on") || use_native.equals_lower("yes") || - use_native.equals_lower("1") || use_native.equals_lower("true"); + return use_native.equals_insensitive("on") || use_native.equals_insensitive("yes") || + use_native.equals_insensitive("1") || use_native.equals_insensitive("true"); #else return true; #endif diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -196,7 +196,7 @@ LanguageType Language::GetLanguageTypeFromString(llvm::StringRef string) { for (const auto &L : language_names) { - if (string.equals_lower(L.name)) + if (string.equals_insensitive(L.name)) return static_cast(L.type); } diff --git a/lldb/source/Target/RegisterContext.cpp b/lldb/source/Target/RegisterContext.cpp --- a/lldb/source/Target/RegisterContext.cpp +++ b/lldb/source/Target/RegisterContext.cpp @@ -58,8 +58,8 @@ for (uint32_t reg = start_idx; reg < num_registers; ++reg) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg); - if (reg_name.equals_lower(reg_info->name) || - reg_name.equals_lower(reg_info->alt_name)) + if (reg_name.equals_insensitive(reg_info->name) || + reg_name.equals_insensitive(reg_info->alt_name)) return reg_info; } return nullptr; diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -464,7 +464,7 @@ // Get an architecture definition by name. static const CoreDefinition *FindCoreDefinition(llvm::StringRef name) { for (unsigned int i = 0; i < llvm::array_lengthof(g_core_definitions); ++i) { - if (name.equals_lower(g_core_definitions[i].name)) + if (name.equals_insensitive(g_core_definitions[i].name)) return &g_core_definitions[i]; } return nullptr; diff --git a/lldb/source/Utility/ConstString.cpp b/lldb/source/Utility/ConstString.cpp --- a/lldb/source/Utility/ConstString.cpp +++ b/lldb/source/Utility/ConstString.cpp @@ -253,7 +253,7 @@ // perform case insensitive equality test llvm::StringRef lhs_string_ref(lhs.GetStringRef()); llvm::StringRef rhs_string_ref(rhs.GetStringRef()); - return lhs_string_ref.equals_lower(rhs_string_ref); + return lhs_string_ref.equals_insensitive(rhs_string_ref); } int ConstString::Compare(ConstString lhs, ConstString rhs, @@ -270,7 +270,7 @@ if (case_sensitive) { return lhs_string_ref.compare(rhs_string_ref); } else { - return lhs_string_ref.compare_lower(rhs_string_ref); + return lhs_string_ref.compare_insensitive(rhs_string_ref); } } diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -500,7 +500,7 @@ raw_ostream &Stream, StringRef Style) { assert( - (Style.empty() || Style.equals_lower("F") || Style.equals_lower("D")) && + (Style.empty() || Style.equals_insensitive("F") || Style.equals_insensitive("D")) && "Invalid FileSpec style!"); StringRef dir = F.GetDirectory().GetStringRef(); @@ -511,7 +511,7 @@ return; } - if (Style.equals_lower("F")) { + if (Style.equals_insensitive("F")) { Stream << (file.empty() ? "(empty)" : file); return; } @@ -527,7 +527,7 @@ Stream << GetPreferredPathSeparator(F.GetPathStyle()); } - if (Style.equals_lower("D")) { + if (Style.equals_insensitive("D")) { // We only want to print the directory, so now just exit. if (dir.empty()) Stream << "(empty)"; diff --git a/lldb/source/Utility/Log.cpp b/lldb/source/Utility/Log.cpp --- a/lldb/source/Utility/Log.cpp +++ b/lldb/source/Utility/Log.cpp @@ -60,17 +60,17 @@ bool list_categories = false; uint32_t flags = 0; for (const char *category : categories) { - if (llvm::StringRef("all").equals_lower(category)) { + if (llvm::StringRef("all").equals_insensitive(category)) { flags |= UINT32_MAX; continue; } - if (llvm::StringRef("default").equals_lower(category)) { + if (llvm::StringRef("default").equals_insensitive(category)) { flags |= entry.second.m_channel.default_flags; continue; } auto cat = llvm::find_if( entry.second.m_channel.categories, - [&](const Log::Category &c) { return c.name.equals_lower(category); }); + [&](const Log::Category &c) { return c.name.equals_insensitive(category); }); if (cat != entry.second.m_channel.categories.end()) { flags |= cat->flag; continue; diff --git a/llvm/include/llvm/ADT/SmallString.h b/llvm/include/llvm/ADT/SmallString.h --- a/llvm/include/llvm/ADT/SmallString.h +++ b/llvm/include/llvm/ADT/SmallString.h @@ -93,8 +93,8 @@ } /// 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 @@ 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/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -189,12 +189,15 @@ compareMemory(Data, RHS.Data, RHS.Length) == 0); } - /// equals_lower - Check for string equality, ignoring case. + /// equals_insensitive - Check for string equality, ignoring case. LLVM_NODISCARD - bool equals_lower(StringRef RHS) const { - return Length == RHS.Length && compare_lower(RHS) == 0; + bool equals_insensitive(StringRef RHS) const { + return Length == RHS.Length && compare_insensitive(RHS) == 0; } + LLVM_NODISCARD + bool equals_lower(StringRef RHS) const { return equals_insensitive(RHS); } + /// compare - Compare two strings; the result is -1, 0, or 1 if this string /// is lexicographically less than, equal to, or greater than the \p RHS. LLVM_NODISCARD @@ -209,9 +212,12 @@ return Length < RHS.Length ? -1 : 1; } - /// compare_lower - Compare two strings, ignoring case. + /// compare_insensitive - Compare two strings, ignoring case. LLVM_NODISCARD - int compare_lower(StringRef RHS) const; + int compare_insensitive(StringRef RHS) const; + + LLVM_NODISCARD + int compare_lower(StringRef RHS) const { return compare_insensitive(RHS); } /// compare_numeric - Compare two strings, treating sequences of digits as /// numbers. @@ -290,7 +296,12 @@ /// Check if this string starts with the given \p Prefix, ignoring case. LLVM_NODISCARD - bool startswith_lower(StringRef Prefix) const; + bool startswith_insensitive(StringRef Prefix) const; + + LLVM_NODISCARD + bool startswith_lower(StringRef Prefix) const { + return startswith_insensitive(Prefix); + } /// Check if this string ends with the given \p Suffix. LLVM_NODISCARD @@ -301,7 +312,12 @@ /// Check if this string ends with the given \p Suffix, ignoring case. LLVM_NODISCARD - bool endswith_lower(StringRef Suffix) const; + bool endswith_insensitive(StringRef Suffix) const; + + LLVM_NODISCARD + bool endswith_lower(StringRef Prefix) const { + return endswith_insensitive(Prefix); + } /// @} /// @name String Searching @@ -327,7 +343,12 @@ /// \returns The index of the first occurrence of \p C, or npos if not /// found. LLVM_NODISCARD - size_t find_lower(char C, size_t From = 0) const; + size_t find_insensitive(char C, size_t From = 0) const; + + LLVM_NODISCARD + size_t find_lower(char C, size_t From = 0) const { + return find_insensitive(C, From); + } /// Search for the first character satisfying the predicate \p F /// @@ -365,7 +386,12 @@ /// \returns The index of the first occurrence of \p Str, or npos if not /// found. LLVM_NODISCARD - size_t find_lower(StringRef Str, size_t From = 0) const; + size_t find_insensitive(StringRef Str, size_t From = 0) const; + + LLVM_NODISCARD + size_t find_lower(StringRef Str, size_t From = 0) const { + return find_insensitive(Str, From); + } /// Search for the last character \p C in the string. /// @@ -388,7 +414,12 @@ /// \returns The index of the last occurrence of \p C, or npos if not /// found. LLVM_NODISCARD - size_t rfind_lower(char C, size_t From = npos) const; + size_t rfind_insensitive(char C, size_t From = npos) const; + + LLVM_NODISCARD + size_t rfind_lower(char C, size_t From = npos) const { + return rfind_insensitive(C, From); + } /// Search for the last string \p Str in the string. /// @@ -402,7 +433,10 @@ /// \returns The index of the last occurrence of \p Str, or npos if not /// found. LLVM_NODISCARD - size_t rfind_lower(StringRef Str) const; + size_t rfind_insensitive(StringRef Str) const; + + LLVM_NODISCARD + size_t rfind_lower(StringRef Str) const { return rfind_insensitive(Str); } /// Find the first character in the string that is \p C, or npos if not /// found. Same as find. @@ -468,15 +502,25 @@ /// Return true if the given string is a substring of *this, and false /// otherwise. + LLVM_NODISCARD + bool contains_insensitive(StringRef Other) const { + return find_insensitive(Other) != npos; + } + LLVM_NODISCARD bool contains_lower(StringRef Other) const { - return find_lower(Other) != npos; + return contains_insensitive(Other); } /// Return true if the given character is contained in *this, and false /// otherwise. LLVM_NODISCARD - bool contains_lower(char C) const { return find_lower(C) != npos; } + bool contains_insensitive(char C) const { + return find_insensitive(C) != npos; + } + + LLVM_NODISCARD + bool contains_lower(char C) const { return contains_insensitive(C); } /// @} /// @name Helpful Algorithms @@ -687,14 +731,18 @@ /// Returns true if this StringRef has the given prefix, ignoring case, /// and removes that prefix. - bool consume_front_lower(StringRef Prefix) { - if (!startswith_lower(Prefix)) + bool consume_front_insensitive(StringRef Prefix) { + if (!startswith_insensitive(Prefix)) return false; *this = drop_front(Prefix.size()); return true; } + bool consume_front_lower(StringRef Prefix) { + return consume_front_insensitive(Prefix); + } + /// Returns true if this StringRef has the given suffix and removes that /// suffix. bool consume_back(StringRef Suffix) { @@ -707,14 +755,18 @@ /// Returns true if this StringRef has the given suffix, ignoring case, /// and removes that suffix. - bool consume_back_lower(StringRef Suffix) { - if (!endswith_lower(Suffix)) + bool consume_back_insensitive(StringRef Suffix) { + if (!endswith_insensitive(Suffix)) return false; *this = drop_back(Suffix.size()); return true; } + bool consume_back_lower(StringRef Suffix) { + return consume_back_insensitive(Suffix); + } + /// Return a reference to the substring from [Start, End). /// /// \param Start The index of the starting character in the substring; if diff --git a/llvm/include/llvm/ADT/StringSwitch.h b/llvm/include/llvm/ADT/StringSwitch.h --- a/llvm/include/llvm/ADT/StringSwitch.h +++ b/llvm/include/llvm/ADT/StringSwitch.h @@ -138,21 +138,21 @@ // 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/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h --- a/llvm/include/llvm/Support/FormatProviders.h +++ b/llvm/include/llvm/Support/FormatProviders.h @@ -75,7 +75,7 @@ } 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/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h --- a/llvm/include/llvm/Support/VirtualFileSystem.h +++ b/llvm/include/llvm/Support/VirtualFileSystem.h @@ -752,7 +752,7 @@ // 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/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -4590,7 +4590,7 @@ 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/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp --- a/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp @@ -163,7 +163,7 @@ 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/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp --- a/llvm/lib/FileCheck/FileCheck.cpp +++ b/llvm/lib/FileCheck/FileCheck.cpp @@ -1229,7 +1229,7 @@ // 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/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -3238,9 +3238,9 @@ 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/llvm/lib/MC/MCParser/COFFMasmParser.cpp b/llvm/lib/MC/MCParser/COFFMasmParser.cpp --- a/llvm/lib/MC/MCParser/COFFMasmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFMasmParser.cpp @@ -322,11 +322,11 @@ 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 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/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/llvm/lib/MC/MCParser/MasmParser.cpp @@ -1133,8 +1133,8 @@ 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 @@ } } // 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 @@ 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 @@ // 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 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ // 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/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp --- a/llvm/lib/Option/OptTable.cpp +++ b/llvm/lib/Option/OptTable.cpp @@ -185,7 +185,7 @@ if (Str.startswith(Prefix)) { StringRef Rest = Str.substr(Prefix.size()); bool Matched = IgnoreCase - ? Rest.startswith_lower(I->Name) + ? Rest.startswith_insensitive(I->Name) : Rest.startswith(I->Name); if (Matched) return Prefix.size() + StringRef(I->Name).size(); diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -159,16 +159,16 @@ 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/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp --- a/llvm/lib/Support/StringExtras.cpp +++ b/llvm/lib/Support/StringExtras.cpp @@ -25,7 +25,7 @@ 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/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp --- a/llvm/lib/Support/StringRef.cpp +++ b/llvm/lib/Support/StringRef.cpp @@ -34,8 +34,8 @@ return 0; } -/// compare_lower - Compare strings, ignoring case. -int StringRef::compare_lower(StringRef RHS) const { +/// compare_insensitive - Compare strings, ignoring case. +int StringRef::compare_insensitive(StringRef RHS) const { if (int Res = ascii_strncasecmp(Data, RHS.Data, std::min(Length, RHS.Length))) return Res; if (Length == RHS.Length) @@ -44,18 +44,18 @@ } /// Check if this string starts with the given \p Prefix, ignoring case. -bool StringRef::startswith_lower(StringRef Prefix) const { +bool StringRef::startswith_insensitive(StringRef Prefix) const { return Length >= Prefix.Length && ascii_strncasecmp(Data, Prefix.Data, Prefix.Length) == 0; } /// Check if this string ends with the given \p Suffix, ignoring case. -bool StringRef::endswith_lower(StringRef Suffix) const { +bool StringRef::endswith_insensitive(StringRef Suffix) const { return Length >= Suffix.Length && ascii_strncasecmp(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0; } -size_t StringRef::find_lower(char C, size_t From) const { +size_t StringRef::find_insensitive(char C, size_t From) const { char L = toLower(C); return find_if([L](char D) { return toLower(D) == L; }, From); } @@ -173,10 +173,10 @@ return npos; } -size_t StringRef::find_lower(StringRef Str, size_t From) const { +size_t StringRef::find_insensitive(StringRef Str, size_t From) const { StringRef This = substr(From); while (This.size() >= Str.size()) { - if (This.startswith_lower(Str)) + if (This.startswith_insensitive(Str)) return From; This = This.drop_front(); ++From; @@ -184,7 +184,7 @@ return npos; } -size_t StringRef::rfind_lower(char C, size_t From) const { +size_t StringRef::rfind_insensitive(char C, size_t From) const { From = std::min(From, Length); size_t i = From; while (i != 0) { @@ -211,13 +211,13 @@ return npos; } -size_t StringRef::rfind_lower(StringRef Str) const { +size_t StringRef::rfind_insensitive(StringRef Str) const { size_t N = Str.size(); if (N > Length) return npos; for (size_t i = Length - N + 1, e = 0; i != e;) { --i; - if (substr(i, N).equals_lower(Str)) + if (substr(i, N).equals_insensitive(Str)) return i; } return npos; diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -1318,12 +1318,12 @@ 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/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/lib/Support/Windows/Path.inc @@ -669,7 +669,7 @@ // 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/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -8038,7 +8038,7 @@ : 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/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp --- a/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp @@ -73,8 +73,8 @@ 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) { @@ -95,8 +95,8 @@ } const StringRef BTIEnable = F.getFnAttribute("branch-target-enforcement").getValueAsString(); - assert(BTIEnable.equals_lower("true") || BTIEnable.equals_lower("false")); - BranchTargetEnforcement = BTIEnable.equals_lower("true"); + assert(BTIEnable.equals_insensitive("true") || BTIEnable.equals_insensitive("false")); + BranchTargetEnforcement = BTIEnable.equals_insensitive("true"); } bool AArch64FunctionInfo::shouldSignReturnAddress(bool SpillsLR) const { diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -2707,7 +2707,7 @@ // 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,9 @@ // 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 +5442,7 @@ 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 +5478,7 @@ return true; bool EnableFeature = true; - if (Name.startswith_lower("no")) { + if (Name.startswith_insensitive("no")) { EnableFeature = false; Name = Name.substr(2); } @@ -5544,7 +5544,7 @@ bool EnableFeature = true; - if (Name.startswith_lower("no")) { + if (Name.startswith_insensitive("no")) { EnableFeature = false; Name = Name.substr(2); } diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp @@ -1370,9 +1370,9 @@ 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/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp @@ -98,12 +98,12 @@ 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/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -18632,7 +18632,7 @@ 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/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5012,7 +5012,7 @@ 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 @@ 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 @@ 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 @@ {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/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp --- a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp +++ b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp @@ -510,19 +510,19 @@ "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,7 @@ 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 +892,7 @@ 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 +910,7 @@ 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/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp @@ -637,9 +637,9 @@ 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/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp b/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp --- a/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp +++ b/llvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp @@ -754,9 +754,9 @@ 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/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp b/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp --- a/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp +++ b/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp @@ -327,7 +327,7 @@ 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 @@ 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/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp --- a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp +++ b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp @@ -1207,28 +1207,28 @@ 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/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -15743,7 +15743,7 @@ &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/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -371,7 +371,7 @@ 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/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp --- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp +++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp @@ -1125,7 +1125,7 @@ return true; } - if (name.substr(0, 3).equals_lower("asr") + if (name.substr(0, 3).equals_insensitive("asr") && !name.substr(3).getAsInteger(10, intVal) && intVal > 0 && intVal < 32) { RegNo = ASRRegs[intVal]; @@ -1196,7 +1196,7 @@ } // %fcc0 - %fcc3 - if (name.substr(0, 3).equals_lower("fcc") + if (name.substr(0, 3).equals_insensitive("fcc") && !name.substr(3).getAsInteger(10, intVal) && intVal < 4) { // FIXME: check 64bit and handle %fcc1 - %fcc3 @@ -1206,7 +1206,7 @@ } // %g0 - %g7 - if (name.substr(0, 1).equals_lower("g") + if (name.substr(0, 1).equals_insensitive("g") && !name.substr(1).getAsInteger(10, intVal) && intVal < 8) { RegNo = IntRegs[intVal]; @@ -1214,21 +1214,21 @@ return true; } // %o0 - %o7 - if (name.substr(0, 1).equals_lower("o") + 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") + 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") + if (name.substr(0, 1).equals_insensitive("i") && !name.substr(1).getAsInteger(10, intVal) && intVal < 8) { RegNo = IntRegs[24 + intVal]; @@ -1236,14 +1236,14 @@ return true; } // %f0 - %f31 - if (name.substr(0, 1).equals_lower("f") + 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") + 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 @@ -1253,7 +1253,7 @@ } // %r0 - %r31 - if (name.substr(0, 1).equals_lower("r") + if (name.substr(0, 1).equals_insensitive("r") && !name.substr(1, 2).getAsInteger(10, intVal) && intVal < 31) { RegNo = IntRegs[intVal]; RegKind = SparcOperand::rk_IntReg; @@ -1261,7 +1261,7 @@ } // %c0 - %c31 - if (name.substr(0, 1).equals_lower("c") + if (name.substr(0, 1).equals_insensitive("c") && !name.substr(1).getAsInteger(10, intVal) && intVal < 32) { RegNo = CoprocRegs[intVal]; diff --git a/llvm/lib/Target/Sparc/LeonPasses.cpp b/llvm/lib/Target/Sparc/LeonPasses.cpp --- a/llvm/lib/Target/Sparc/LeonPasses.cpp +++ b/llvm/lib/Target/Sparc/LeonPasses.cpp @@ -87,7 +87,7 @@ 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/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp --- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp +++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp @@ -391,9 +391,9 @@ 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/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1784,21 +1784,21 @@ 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 @@ } 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 @@ 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 @@ } // 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 @@ (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 @@ 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/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp --- a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp @@ -332,7 +332,7 @@ 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/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -51968,21 +51968,21 @@ } // 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/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp --- a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp @@ -99,10 +99,10 @@ // 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/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp --- a/llvm/tools/bugpoint/ToolRunner.cpp +++ b/llvm/tools/bugpoint/ToolRunner.cpp @@ -607,12 +607,12 @@ 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/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp --- a/llvm/tools/llvm-ar/llvm-ar.cpp +++ b/llvm/tools/llvm-ar/llvm-ar.cpp @@ -126,9 +126,9 @@ )"; 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 @@ // 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/llvm/tools/llvm-cov/llvm-cov.cpp b/llvm/tools/llvm-cov/llvm-cov.cpp --- a/llvm/tools/llvm-cov/llvm-cov.cpp +++ b/llvm/tools/llvm-cov/llvm-cov.cpp @@ -60,7 +60,7 @@ 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/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp --- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp +++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp @@ -479,12 +479,12 @@ 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/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp --- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -81,7 +81,7 @@ // 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/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2527,7 +2527,7 @@ // 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/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp --- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -350,13 +350,13 @@ 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/llvm/tools/llvm-rc/ResourceFileWriter.cpp b/llvm/tools/llvm-rc/ResourceFileWriter.cpp --- a/llvm/tools/llvm-rc/ResourceFileWriter.cpp +++ b/llvm/tools/llvm-rc/ResourceFileWriter.cpp @@ -99,7 +99,7 @@ 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/llvm/tools/llvm-rc/ResourceScriptCppFilter.cpp b/llvm/tools/llvm-rc/ResourceScriptCppFilter.cpp --- a/llvm/tools/llvm-rc/ResourceScriptCppFilter.cpp +++ b/llvm/tools/llvm-rc/ResourceScriptCppFilter.cpp @@ -91,7 +91,7 @@ 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/llvm/tools/llvm-rc/ResourceScriptParser.cpp b/llvm/tools/llvm-rc/ResourceScriptParser.cpp --- a/llvm/tools/llvm-rc/ResourceScriptParser.cpp +++ b/llvm/tools/llvm-rc/ResourceScriptParser.cpp @@ -215,7 +215,7 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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/llvm/tools/llvm-rc/ResourceScriptStmt.h b/llvm/tools/llvm-rc/ResourceScriptStmt.h --- a/llvm/tools/llvm-rc/ResourceScriptStmt.h +++ b/llvm/tools/llvm-rc/ResourceScriptStmt.h @@ -145,7 +145,7 @@ : 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/llvm/tools/llvm-rc/ResourceScriptToken.cpp b/llvm/tools/llvm-rc/ResourceScriptToken.cpp --- a/llvm/tools/llvm-rc/ResourceScriptToken.cpp +++ b/llvm/tools/llvm-rc/ResourceScriptToken.cpp @@ -350,9 +350,9 @@ 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/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp --- a/llvm/tools/llvm-rc/llvm-rc.cpp +++ b/llvm/tools/llvm-rc/llvm-rc.cpp @@ -262,10 +262,10 @@ // 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/llvm/unittests/ADT/SmallStringTest.cpp b/llvm/unittests/ADT/SmallStringTest.cpp --- a/llvm/unittests/ADT/SmallStringTest.cpp +++ b/llvm/unittests/ADT/SmallStringTest.cpp @@ -210,12 +210,12 @@ 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/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/unittests/ADT/StringRefTest.cpp @@ -98,15 +98,15 @@ EXPECT_EQ( 1, StringRef("aab").compare("aa")); EXPECT_EQ( 1, StringRef("\xFF").compare("\1")); - EXPECT_EQ(-1, StringRef("AaB").compare_lower("aAd")); - EXPECT_EQ( 0, StringRef("AaB").compare_lower("aab")); - EXPECT_EQ( 1, StringRef("AaB").compare_lower("AAA")); - EXPECT_EQ(-1, StringRef("AaB").compare_lower("aaBb")); - EXPECT_EQ(-1, StringRef("AaB").compare_lower("bb")); - EXPECT_EQ( 1, StringRef("aaBb").compare_lower("AaB")); - EXPECT_EQ( 1, StringRef("bb").compare_lower("AaB")); - EXPECT_EQ( 1, StringRef("AaB").compare_lower("aA")); - EXPECT_EQ( 1, StringRef("\xFF").compare_lower("\1")); + EXPECT_EQ(-1, StringRef("AaB").compare_insensitive("aAd")); + EXPECT_EQ( 0, StringRef("AaB").compare_insensitive("aab")); + EXPECT_EQ( 1, StringRef("AaB").compare_insensitive("AAA")); + EXPECT_EQ(-1, StringRef("AaB").compare_insensitive("aaBb")); + EXPECT_EQ(-1, StringRef("AaB").compare_insensitive("bb")); + EXPECT_EQ( 1, StringRef("aaBb").compare_insensitive("AaB")); + EXPECT_EQ( 1, StringRef("bb").compare_insensitive("AaB")); + EXPECT_EQ( 1, StringRef("AaB").compare_insensitive("aA")); + EXPECT_EQ( 1, StringRef("\xFF").compare_insensitive("\1")); EXPECT_EQ(-1, StringRef("aab").compare_numeric("aad")); EXPECT_EQ( 0, StringRef("aab").compare_numeric("aab")); @@ -366,14 +366,14 @@ EXPECT_FALSE(Str.startswith("hi")); } -TEST(StringRefTest, StartsWithLower) { +TEST(StringRefTest, StartsWithInsensitive) { StringRef Str("heLLo"); - EXPECT_TRUE(Str.startswith_lower("")); - EXPECT_TRUE(Str.startswith_lower("he")); - EXPECT_TRUE(Str.startswith_lower("hell")); - EXPECT_TRUE(Str.startswith_lower("HELlo")); - EXPECT_FALSE(Str.startswith_lower("helloworld")); - EXPECT_FALSE(Str.startswith_lower("hi")); + EXPECT_TRUE(Str.startswith_insensitive("")); + EXPECT_TRUE(Str.startswith_insensitive("he")); + EXPECT_TRUE(Str.startswith_insensitive("hell")); + EXPECT_TRUE(Str.startswith_insensitive("HELlo")); + EXPECT_FALSE(Str.startswith_insensitive("helloworld")); + EXPECT_FALSE(Str.startswith_insensitive("hi")); } TEST(StringRefTest, ConsumeFront) { @@ -392,22 +392,22 @@ EXPECT_TRUE(Str.consume_front("")); } -TEST(StringRefTest, ConsumeFrontLower) { +TEST(StringRefTest, ConsumeFrontInsensitive) { StringRef Str("heLLo"); - EXPECT_TRUE(Str.consume_front_lower("")); + EXPECT_TRUE(Str.consume_front_insensitive("")); EXPECT_EQ("heLLo", Str); EXPECT_FALSE(Str.consume_front("HEl")); EXPECT_EQ("heLLo", Str); - EXPECT_TRUE(Str.consume_front_lower("HEl")); + EXPECT_TRUE(Str.consume_front_insensitive("HEl")); EXPECT_EQ("Lo", Str); - EXPECT_FALSE(Str.consume_front_lower("loworld")); + EXPECT_FALSE(Str.consume_front_insensitive("loworld")); EXPECT_EQ("Lo", Str); - EXPECT_FALSE(Str.consume_front_lower("ol")); + EXPECT_FALSE(Str.consume_front_insensitive("ol")); EXPECT_EQ("Lo", Str); - EXPECT_TRUE(Str.consume_front_lower("lo")); + EXPECT_TRUE(Str.consume_front_insensitive("lo")); EXPECT_EQ("", Str); - EXPECT_FALSE(Str.consume_front_lower("o")); - EXPECT_TRUE(Str.consume_front_lower("")); + EXPECT_FALSE(Str.consume_front_insensitive("o")); + EXPECT_TRUE(Str.consume_front_insensitive("")); } TEST(StringRefTest, EndsWith) { @@ -419,14 +419,14 @@ EXPECT_FALSE(Str.endswith("so")); } -TEST(StringRefTest, EndsWithLower) { +TEST(StringRefTest, EndsWithInsensitive) { StringRef Str("heLLo"); - EXPECT_TRUE(Str.endswith_lower("")); - EXPECT_TRUE(Str.endswith_lower("lo")); - EXPECT_TRUE(Str.endswith_lower("LO")); - EXPECT_TRUE(Str.endswith_lower("ELlo")); - EXPECT_FALSE(Str.endswith_lower("helloworld")); - EXPECT_FALSE(Str.endswith_lower("hi")); + EXPECT_TRUE(Str.endswith_insensitive("")); + EXPECT_TRUE(Str.endswith_insensitive("lo")); + EXPECT_TRUE(Str.endswith_insensitive("LO")); + EXPECT_TRUE(Str.endswith_insensitive("ELlo")); + EXPECT_FALSE(Str.endswith_insensitive("helloworld")); + EXPECT_FALSE(Str.endswith_insensitive("hi")); } TEST(StringRefTest, ConsumeBack) { @@ -445,22 +445,22 @@ EXPECT_TRUE(Str.consume_back("")); } -TEST(StringRefTest, ConsumeBackLower) { +TEST(StringRefTest, ConsumeBackInsensitive) { StringRef Str("heLLo"); - EXPECT_TRUE(Str.consume_back_lower("")); + EXPECT_TRUE(Str.consume_back_insensitive("")); EXPECT_EQ("heLLo", Str); EXPECT_FALSE(Str.consume_back("lO")); EXPECT_EQ("heLLo", Str); - EXPECT_TRUE(Str.consume_back_lower("lO")); + EXPECT_TRUE(Str.consume_back_insensitive("lO")); EXPECT_EQ("heL", Str); - EXPECT_FALSE(Str.consume_back_lower("helhel")); + EXPECT_FALSE(Str.consume_back_insensitive("helhel")); EXPECT_EQ("heL", Str); - EXPECT_FALSE(Str.consume_back_lower("hle")); + EXPECT_FALSE(Str.consume_back_insensitive("hle")); EXPECT_EQ("heL", Str); - EXPECT_TRUE(Str.consume_back_lower("hEl")); + EXPECT_TRUE(Str.consume_back_insensitive("hEl")); EXPECT_EQ("", Str); - EXPECT_FALSE(Str.consume_back_lower("h")); - EXPECT_TRUE(Str.consume_back_lower("")); + EXPECT_FALSE(Str.consume_back_insensitive("h")); + EXPECT_TRUE(Str.consume_back_insensitive("")); } TEST(StringRefTest, Find) { @@ -472,7 +472,7 @@ char C; std::size_t From; std::size_t Pos; - std::size_t LowerPos; + std::size_t InsensitivePos; } CharExpectations[] = { {Str, 'h', 0U, 0U, 0U}, {Str, 'e', 0U, 1U, 1U}, @@ -488,7 +488,7 @@ llvm::StringRef S; std::size_t From; std::size_t Pos; - std::size_t LowerPos; + std::size_t InsensitivePos; } StrExpectations[] = { {Str, "helloword", 0, StringRef::npos, StringRef::npos}, {Str, "hello", 0, 0U, 0U}, @@ -507,14 +507,14 @@ for (auto &E : CharExpectations) { EXPECT_EQ(E.Pos, E.Str.find(E.C, E.From)); - EXPECT_EQ(E.LowerPos, E.Str.find_lower(E.C, E.From)); - EXPECT_EQ(E.LowerPos, E.Str.find_lower(toupper(E.C), E.From)); + EXPECT_EQ(E.InsensitivePos, E.Str.find_insensitive(E.C, E.From)); + EXPECT_EQ(E.InsensitivePos, E.Str.find_insensitive(toupper(E.C), E.From)); } for (auto &E : StrExpectations) { EXPECT_EQ(E.Pos, E.Str.find(E.S, E.From)); - EXPECT_EQ(E.LowerPos, E.Str.find_lower(E.S, E.From)); - EXPECT_EQ(E.LowerPos, E.Str.find_lower(E.S.upper(), E.From)); + EXPECT_EQ(E.InsensitivePos, E.Str.find_insensitive(E.S, E.From)); + EXPECT_EQ(E.InsensitivePos, E.Str.find_insensitive(E.S.upper(), E.From)); } EXPECT_EQ(3U, Str.rfind('l')); @@ -524,10 +524,10 @@ EXPECT_EQ(1U, Str.rfind("ello")); EXPECT_EQ(StringRef::npos, Str.rfind("zz")); - EXPECT_EQ(8U, Str.rfind_lower('l')); - EXPECT_EQ(8U, Str.rfind_lower('L')); - EXPECT_EQ(StringRef::npos, Str.rfind_lower('z')); - EXPECT_EQ(StringRef::npos, Str.rfind_lower("HELLOWORLD")); + EXPECT_EQ(8U, Str.rfind_insensitive('l')); + EXPECT_EQ(8U, Str.rfind_insensitive('L')); + EXPECT_EQ(StringRef::npos, Str.rfind_insensitive('z')); + EXPECT_EQ(StringRef::npos, Str.rfind_insensitive("HELLOWORLD")); EXPECT_EQ(5U, Str.rfind("HELLO")); EXPECT_EQ(6U, Str.rfind("ELLO")); EXPECT_EQ(StringRef::npos, Str.rfind("ZZ")); diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -1123,7 +1123,7 @@ llvm::sys::path::is_absolute(__argv[0])); EXPECT_TRUE(llvm::sys::path::filename(argv[0]) - .equals_lower("supporttests.exe")) + .equals_insensitive("supporttests.exe")) << "Filename of test executable is " << llvm::sys::path::filename(argv[0]); } diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -612,7 +612,7 @@ /// 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()) diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp --- a/mlir/test/lib/Dialect/Test/TestTypes.cpp +++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp @@ -31,11 +31,11 @@ auto loc = parser.getCurrentLocation(); if (parser.parseKeyword(&signStr)) return failure(); - if (signStr.compare_lower("u") || signStr.compare_lower("unsigned")) + if (signStr.compare_insensitive("u") || signStr.compare_insensitive("unsigned")) result = TestIntegerType::SignednessSemantics::Unsigned; - else if (signStr.compare_lower("s") || signStr.compare_lower("signed")) + else if (signStr.compare_insensitive("s") || signStr.compare_insensitive("signed")) result = TestIntegerType::SignednessSemantics::Signed; - else if (signStr.compare_lower("n") || signStr.compare_lower("none")) + else if (signStr.compare_insensitive("n") || signStr.compare_insensitive("none")) result = TestIntegerType::SignednessSemantics::Signless; else return parser.emitError(loc, "expected signed, unsigned, or none");