[clang] e5c7c17 - [clang] Rename StringRef _lower() method calls to _insensitive()

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 28 12:55:17 PDT 2021


Ah, found it in https://reviews.llvm.org/D104819 - good to leave that in in
the "Differential Revision: " part of the commit message (or if you end up
splitting patches off from a review, such that it doesn't necessarily make
sense for it to close the review (preparatory patches, etc) then linking to
the review without the "Differential Revision: " prefix and/or linking to a
design discussion, etc).

All good - thanks for the renaming!

On Mon, Jun 28, 2021 at 11:38 AM David Blaikie <dblaikie at gmail.com> wrote:

> Was this design/code reviewed (there's no mention in the commit message of
> a link to a phab review, for instance)? Probably worth some discussion - if
> there was a review, could you link it here in a reply?
>
> On Thu, Jun 24, 2021 at 2:23 PM Martin Storsjö via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>>
>> Author: Martin Storsjö
>> Date: 2021-06-25T00:22:01+03:00
>> New Revision: e5c7c171e5db6af1e3dca1059df4287b0d147eaf
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/e5c7c171e5db6af1e3dca1059df4287b0d147eaf
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/e5c7c171e5db6af1e3dca1059df4287b0d147eaf.diff
>>
>> LOG: [clang] Rename StringRef _lower() method calls to _insensitive()
>>
>> This is mostly a mechanical change, but a testcase that contains
>> parts of the StringRef class (clang/test/Analysis/llvm-conventions.cpp)
>> isn't touched.
>>
>> Added:
>>
>>
>> Modified:
>>     clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
>>     clang/lib/Analysis/CalledOnceCheck.cpp
>>     clang/lib/Analysis/RetainSummaryManager.cpp
>>     clang/lib/Basic/FileManager.cpp
>>     clang/lib/CodeGen/TargetInfo.cpp
>>     clang/lib/Driver/Driver.cpp
>>     clang/lib/Driver/ToolChains/Arch/RISCV.cpp
>>     clang/lib/Driver/ToolChains/Clang.cpp
>>     clang/lib/Driver/ToolChains/Fuchsia.cpp
>>     clang/lib/Driver/ToolChains/Gnu.cpp
>>     clang/lib/Driver/ToolChains/Hexagon.cpp
>>     clang/lib/Driver/ToolChains/MSVC.cpp
>>     clang/lib/Driver/ToolChains/MinGW.cpp
>>     clang/lib/Format/Format.cpp
>>     clang/lib/Format/SortJavaScriptImports.cpp
>>     clang/lib/Format/UsingDeclarationsSorter.cpp
>>     clang/lib/Frontend/CompilerInvocation.cpp
>>     clang/lib/Lex/HeaderMap.cpp
>>     clang/lib/Lex/PPDirectives.cpp
>>     clang/lib/Lex/PPMacroExpansion.cpp
>>     clang/lib/Sema/CodeCompleteConsumer.cpp
>>     clang/lib/Sema/SemaChecking.cpp
>>     clang/lib/Sema/SemaCodeComplete.cpp
>>     clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
>>     clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
>>     clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
>>     clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
>>     clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
>>     clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
>>     clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
>>     clang/tools/clang-refactor/TestSupport.cpp
>>     clang/tools/clang-scan-deps/ClangScanDeps.cpp
>>     clang/tools/driver/driver.cpp
>>     clang/tools/libclang/CIndexCodeCompletion.cpp
>>     clang/unittests/Tooling/CompilationDatabaseTest.cpp
>>
>> Removed:
>>
>>
>>
>>
>> ################################################################################
>> diff  --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
>> b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
>> index f6fdbe868e2df..40db70e6f4a51 100644
>> --- a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
>> +++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
>> @@ -20,7 +20,7 @@ getBestGuess(llvm::StringRef Search,
>> llvm::ArrayRef<llvm::StringRef> Allowed,
>>      ++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 @@ getBestGuess(llvm::StringRef Search,
>> llvm::ArrayRef<llvm::StringRef> Allowed,
>>        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
>> index db094129a9608..661f7b999f2b9 100644
>> --- a/clang/lib/Analysis/CalledOnceCheck.cpp
>> +++ b/clang/lib/Analysis/CalledOnceCheck.cpp
>> @@ -478,7 +478,7 @@ bool mentionsAnyOfConventionalNames(const Expr *E) {
>>      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
>> index 58ead1dfe3522..7ed1e40333f43 100644
>> --- a/clang/lib/Analysis/RetainSummaryManager.cpp
>> +++ b/clang/lib/Analysis/RetainSummaryManager.cpp
>> @@ -189,20 +189,22 @@ static bool hasRCAnnotation(const Decl *D,
>> StringRef rcAnnotation) {
>>  }
>>
>>  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 +1102,7 @@
>> RetainSummaryManager::getStandardMethodSummary(const ObjCMethodDecl *MD,
>>    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
>> index d39d7ba22643b..df306bd83136e 100644
>> --- a/clang/lib/Basic/FileManager.cpp
>> +++ b/clang/lib/Basic/FileManager.cpp
>> @@ -128,7 +128,7 @@ FileManager::getDirectoryRef(StringRef DirName, bool
>> CacheFailure) {
>>    // 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
>> index 2b3c0e3492a05..e9565a5aef63d 100644
>> --- a/clang/lib/CodeGen/TargetInfo.cpp
>> +++ b/clang/lib/CodeGen/TargetInfo.cpp
>> @@ -2610,7 +2610,7 @@ static std::string
>> qualifyWindowsLibrary(llvm::StringRef Lib) {
>>    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
>> index 930941fe8558c..1afaaba79105b 100644
>> --- a/clang/lib/Driver/Driver.cpp
>> +++ b/clang/lib/Driver/Driver.cpp
>> @@ -591,9 +591,9 @@ static llvm::Triple computeTargetTriple(const Driver
>> &D,
>>    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 @@ void Driver::HandleAutocompletions(StringRef
>> PassedFlags) const {
>>    // 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,8 @@ void Driver::handleArguments(Compilation &C,
>> DerivedArgList &Args,
>>      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 +5347,7 @@ const ToolChain &Driver::getToolChain(const ArgList
>> &Args,
>>        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<toolchains::CrossWindowsToolChain>(
>>                *this, Target, Args);
>>          else
>>
>> diff  --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
>> b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
>> index c7f2a3ea5e023..f131d5321070c 100644
>> --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
>> +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
>> @@ -610,17 +610,19 @@ StringRef riscv::getRISCVABI(const ArgList &Args,
>> const llvm::Triple &Triple) {
>>    // 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 +698,11 @@ StringRef riscv::getRISCVArch(const
>> llvm::opt::ArgList &Args,
>>    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
>> index 29b15b516b9e5..f1b5e25525979 100644
>> --- a/clang/lib/Driver/ToolChains/Clang.cpp
>> +++ b/clang/lib/Driver/ToolChains/Clang.cpp
>> @@ -2063,7 +2063,7 @@ static void SetRISCVSmallDataLimit(const ToolChain
>> &TC, const ArgList &Args,
>>        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";
>> @@ -6331,7 +6331,7 @@ void Clang::ConstructJob(Compilation &C, const
>> JobAction &JA,
>>    // -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;
>>    }
>> @@ -6339,7 +6339,7 @@ void Clang::ConstructJob(Compilation &C, const
>> JobAction &JA,
>>    // -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;
>>    }
>> @@ -7266,17 +7266,17 @@ void Clang::AddClangCLArgs(const ArgList &Args,
>> types::ID InputType,
>>      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
>> index 502afdc1e30c9..fd9804a7f3532 100644
>> --- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
>> +++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
>> @@ -54,8 +54,8 @@ void fuchsia::Linker::ConstructJob(Compilation &C,
>> const JobAction &JA,
>>    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
>> index 517ba60e0b77c..bd5f9c744bba6 100644
>> --- a/clang/lib/Driver/ToolChains/Gnu.cpp
>> +++ b/clang/lib/Driver/ToolChains/Gnu.cpp
>> @@ -51,9 +51,9 @@ static void normalizeCPUNamesForAssembler(const ArgList
>> &Args,
>>                                            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
>> index e58b666dbfc00..df97da5a20d6d 100644
>> --- a/clang/lib/Driver/ToolChains/Hexagon.cpp
>> +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
>> @@ -38,7 +38,7 @@ static void handleHVXWarnings(const Driver &D, const
>> ArgList &Args) {
>>    // 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 @@ constructHexagonLinkArgs(Compilation &C, const
>> JobAction &JA,
>>    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
>> index 98cf0fff49b2a..0dc94a4c6c7dc 100644
>> --- a/clang/lib/Driver/ToolChains/MSVC.cpp
>> +++ b/clang/lib/Driver/ToolChains/MSVC.cpp
>> @@ -181,24 +181,25 @@ findVCToolChainViaEnvironment(llvm::vfs::FileSystem
>> &VFS, std::string &Path,
>>
>>        // 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 +218,7 @@ findVCToolChainViaEnvironment(llvm::vfs::FileSystem
>> &VFS, std::string &Path,
>>          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 +508,15 @@ void visualstudio::Linker::ConstructJob(Compilation
>> &C, const JobAction &JA,
>>    // 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 +586,10 @@ void visualstudio::Linker::ConstructJob(Compilation
>> &C, const JobAction &JA,
>>      = 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 +648,7 @@ void visualstudio::Linker::ConstructJob(Compilation
>> &C, const JobAction &JA,
>>        // 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
>> index 4ebcdf6a94455..467a5479bfb74 100644
>> --- a/clang/lib/Driver/ToolChains/MinGW.cpp
>> +++ b/clang/lib/Driver/ToolChains/MinGW.cpp
>> @@ -427,7 +427,7 @@ toolchains::MinGW::MinGW(const Driver &D, const
>> llvm::Triple &Triple,
>>
>>    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
>> index 71b7820c2b1c6..e95ec55d0805d 100644
>> --- a/clang/lib/Format/Format.cpp
>> +++ b/clang/lib/Format/Format.cpp
>> @@ -1441,23 +1441,23 @@ FormatStyle getNoStyle() {
>>
>>  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;
>> @@ -2973,22 +2973,23 @@ const char *StyleOptionHelpDescription =
>>  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;
>>  }
>> @@ -3048,7 +3049,7 @@ llvm::Expected<FormatStyle> getStyle(StringRef
>> StyleName, StringRef FileName,
>>    // 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
>> index 901204c297f9d..a5e3ce69207bd 100644
>> --- a/clang/lib/Format/SortJavaScriptImports.cpp
>> +++ b/clang/lib/Format/SortJavaScriptImports.cpp
>> @@ -113,7 +113,7 @@ bool operator<(const JsModuleReference &LHS, const
>> JsModuleReference &RHS) {
>>    // 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 @@ class JavaScriptImportSorter : public TokenAnalyzer {
>>      SmallVector<JsImportedSymbol, 1> 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
>> index b6559db61d0cb..5608a5a759537 100644
>> --- a/clang/lib/Format/UsingDeclarationsSorter.cpp
>> +++ b/clang/lib/Format/UsingDeclarationsSorter.cpp
>> @@ -48,7 +48,7 @@ int compareLabels(StringRef A, StringRef B) {
>>          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 @@ int compareLabels(StringRef A, StringRef B) {
>>        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
>> index c1b7b027b3b4d..126e9c7a9cd5e 100644
>> --- a/clang/lib/Frontend/CompilerInvocation.cpp
>> +++ b/clang/lib/Frontend/CompilerInvocation.cpp
>> @@ -3986,13 +3986,13 @@ bool
>> CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
>>    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 @@ bool
>> CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
>>      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
>> index 4b60cfa7b52dd..ae5e6b221953f 100644
>> --- a/clang/lib/Lex/HeaderMap.cpp
>> +++ b/clang/lib/Lex/HeaderMap.cpp
>> @@ -224,7 +224,7 @@ StringRef HeaderMapImpl::lookupFilename(StringRef
>> Filename,
>>      Optional<StringRef> 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
>> index 87741b0a024a2..d0e4962a37479 100644
>> --- a/clang/lib/Lex/PPDirectives.cpp
>> +++ b/clang/lib/Lex/PPDirectives.cpp
>> @@ -196,7 +196,7 @@ static MacroDiag shouldWarnOnMacroUndef(Preprocessor
>> &PP, IdentifierInfo *II) {
>>  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,8 @@ static bool
>> trySimplifyPath(SmallVectorImpl<StringRef> &Components,
>>          // If these path components
>> diff er 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
>> index 74ef9df592dbe..8728ac9e2166e 100644
>> --- a/clang/lib/Lex/PPMacroExpansion.cpp
>> +++ b/clang/lib/Lex/PPMacroExpansion.cpp
>> @@ -1430,7 +1430,7 @@ static bool isTargetVendor(const TargetInfo &TI,
>> const IdentifierInfo *II) {
>>    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
>> index 678a09ba10034..3ab2a18f5e8d5 100644
>> --- a/clang/lib/Sema/CodeCompleteConsumer.cpp
>> +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp
>> @@ -755,7 +755,7 @@ bool clang::operator<(const CodeCompletionResult &X,
>>    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
>> index 3b95a1344075a..561c83eddce2f 100644
>> --- a/clang/lib/Sema/SemaChecking.cpp
>> +++ b/clang/lib/Sema/SemaChecking.cpp
>> @@ -6971,18 +6971,18 @@ bool Sema::SemaBuiltinARMSpecialReg(unsigned
>> BuiltinID, CallExpr *TheCall,
>>
>>      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] = 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
>> index 1ab9c50709a9d..e03b671ae61e7 100644
>> --- a/clang/lib/Sema/SemaCodeComplete.cpp
>> +++ b/clang/lib/Sema/SemaCodeComplete.cpp
>> @@ -9491,10 +9491,10 @@ void
>> Sema::CodeCompleteIncludedFile(llvm::StringRef Dir, bool Angled) {
>>          // 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
>> index 4e49dbc2facce..69b90be9aa7e6 100644
>> --- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
>> +++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
>> @@ -2039,7 +2039,7 @@ void
>> CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallExpr *CE,
>>          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
>> index 73c6517fd0ebf..1a7f0d5ab74c2 100644
>> --- a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
>> +++ b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
>> @@ -763,14 +763,14 @@ bool isBeginCall(const FunctionDecl *Func) {
>>    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
>> index 63fbe75fd4983..8e02ef74c6686 100644
>> --- a/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
>> +++ b/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
>> @@ -80,7 +80,7 @@ static bool isTest(const Decl *D) {
>>      if (const auto *CD = dyn_cast<ObjCContainerDecl>(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
>> index ac0f24603dd90..4961901499914 100644
>> --- a/clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
>> +++ b/clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
>> @@ -29,8 +29,8 @@ bool isIterator(const CXXRecordDecl *CRD) {
>>      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
>> index e0f0dc35e7a71..a6470da09c458 100644
>> --- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
>> +++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
>> @@ -3145,9 +3145,10 @@ static SymbolRef
>> findFailedReallocSymbol(ProgramStateRef currState,
>>  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
>> index d1f984632660f..fbceb26c39c7c 100644
>> --- a/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
>> +++ b/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
>> @@ -252,9 +252,9 @@ bool IncludeCategoryManager::isMainHeader(StringRef
>> IncludeName) const {
>>    //  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
>> index 3b65504b98ea3..650e510fb68ff 100644
>> --- a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
>> +++ b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
>> @@ -256,7 +256,7 @@ struct TransferableCommand {
>>
>>      // 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
>> index 34499b93c97ea..eb880889749f5 100644
>> --- a/clang/tools/clang-refactor/TestSupport.cpp
>> +++ b/clang/tools/clang-refactor/TestSupport.cpp
>> @@ -328,8 +328,8 @@ findTestSelectionRanges(StringRef Filename) {
>>      // 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
>> index 49c4757686623..b6533361c5296 100644
>> --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
>> +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
>> @@ -465,7 +465,7 @@ int main(int argc, const char **argv) {
>>          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
>> index ee3ffe3012d1e..9e3f51db21a9d 100644
>> --- a/clang/tools/driver/driver.cpp
>> +++ b/clang/tools/driver/driver.cpp
>> @@ -273,7 +273,7 @@ static void
>> FixupDiagPrefixExeName(TextDiagnosticPrinter *DiagClient,
>>    // 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
>> index 6685c892749ea..68f35c41efd74 100644
>> --- a/clang/tools/libclang/CIndexCodeCompletion.cpp
>> +++ b/clang/tools/libclang/CIndexCodeCompletion.cpp
>> @@ -1026,7 +1026,7 @@ namespace {
>>        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
>> index 8ff3387d3c185..9a04de32c852d 100644
>> --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp
>> +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp
>> @@ -210,7 +210,7 @@ TEST(JSONCompilationDatabase,
>> ArgumentsPreferredOverCommand) {
>>  struct FakeComparator : public PathComparator {
>>    ~FakeComparator() override {}
>>    bool equivalent(StringRef FileA, StringRef FileB) const override {
>> -    return FileA.equals_lower(FileB);
>> +    return FileA.equals_insensitive(FileB);
>>    }
>>  };
>>
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210628/758e92d7/attachment-0001.html>


More information about the cfe-commits mailing list