[lldb] Rename StringRef _lower() method calls to _insensitive()
authorMartin Storsjö <martin@martin.st>
Thu, 24 Jun 2021 08:06:42 +0000 (11:06 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 24 Jun 2021 21:22:01 +0000 (00:22 +0300)
23 files changed:
lldb/source/Commands/CommandObjectMultiword.cpp
lldb/source/Host/common/NativeRegisterContext.cpp
lldb/source/Host/windows/ProcessLauncherWindows.cpp
lldb/source/Initialization/SystemInitializerCommon.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Interpreter/OptionArgParser.cpp
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Target/Language.cpp
lldb/source/Target/RegisterContext.cpp
lldb/source/Utility/ArchSpec.cpp
lldb/source/Utility/ConstString.cpp
lldb/source/Utility/FileSpec.cpp
lldb/source/Utility/Log.cpp

index 3eafd00..a523fd0 100644 (file)
@@ -98,7 +98,7 @@ bool CommandObjectMultiword::Execute(const char *args_string,
     return result.Succeeded();
   }
 
-  if (sub_command.equals_lower("help")) {
+  if (sub_command.equals_insensitive("help")) {
     this->CommandObject::GenerateHelpText(result);
     return result.Succeeded();
   }
index 9bb877f..c534c7a 100644 (file)
@@ -60,8 +60,8 @@ NativeRegisterContext::GetRegisterInfoByName(llvm::StringRef reg_name,
   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;
index bbfe4d0..fc8da14 100644 (file)
@@ -86,7 +86,7 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
   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;
   }
index 004fdb1..f6012ed 100644 (file)
@@ -96,7 +96,7 @@ llvm::Error SystemInitializerCommon::Initialize() {
 #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
index 8a3a409..2e07ff5 100644 (file)
@@ -2675,7 +2675,7 @@ void CommandInterpreter::FindCommandsForApropos(
     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)) {
index 5fa8468..a7dcd56 100644 (file)
@@ -316,11 +316,11 @@ bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
   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 @@ bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
         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;
     }
   }
index 3dcb30e..93b01ab 100644 (file)
@@ -20,11 +20,11 @@ bool OptionArgParser::ToBoolean(llvm::StringRef ref, bool fail_value,
   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 @@ lldb::ScriptLanguage OptionArgParser::ToScriptLanguage(
   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)
index c1551bd..ae07379 100644 (file)
@@ -630,11 +630,11 @@ void OptionValueProperties::Apropos(
       } 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) {
index 3802f2d..7351143 100644 (file)
@@ -85,11 +85,11 @@ ScriptInterpreter::GetStatusFromSBError(const lldb::SBError &error) const {
 
 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;
 }
index d946517..895fd55 100644 (file)
@@ -1152,7 +1152,7 @@ bool CPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const {
   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;
   }
 
index 3fb0c9e..379c534 100644 (file)
@@ -1134,7 +1134,7 @@ bool ObjCLanguage::IsNilReference(ValueObject &valobj) {
 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;
index 0a4017e..3599785 100644 (file)
@@ -19,7 +19,7 @@ LLDB_PLUGIN_DEFINE(ObjCPlusPlusLanguage)
 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;
index 03a3354..379496b 100644 (file)
@@ -86,10 +86,10 @@ ProcessSP ProcessWindows::CreateInstance(lldb::TargetSP target_sp,
 
 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() {
index ce2cbb1..5cb39cb 100644 (file)
@@ -548,7 +548,7 @@ void ProcessMinidump::ReadModuleList() {
 
     // 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;
     }
 
index f25dc84..9f09c0a 100644 (file)
@@ -43,7 +43,7 @@ static bool IsMainFile(llvm::StringRef main, llvm::StringRef other) {
 
   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) {
index ecae767..4f570d5 100644 (file)
@@ -41,7 +41,7 @@ static uint32_t ResolveLLDBRegisterNum(llvm::StringRef reg_name, llvm::Triple::A
   auto it = llvm::find_if(
       register_names,
       [&reg_name](const llvm::EnumEntry<uint16_t> &register_entry) {
-        return reg_name.compare_lower(register_entry.Name) == 0;
+        return reg_name.compare_insensitive(register_entry.Name) == 0;
       });
 
   if (it == register_names.end())
index 882e363..ee4b791 100644 (file)
@@ -84,8 +84,10 @@ bool ShouldAddLine(uint32_t requested_line, uint32_t actual_line,
 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
index a6010b7..4a2af26 100644 (file)
@@ -196,7 +196,7 @@ static uint32_t num_languages =
 
 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<LanguageType>(L.type);
   }
 
index 845d7b4..bd50a94 100644 (file)
@@ -58,8 +58,8 @@ RegisterContext::GetRegisterInfoByName(llvm::StringRef reg_name,
   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;
index 604131c..0fec259 100644 (file)
@@ -464,7 +464,7 @@ static const ArchDefinition *FindArchDefinition(ArchitectureType arch_type) {
 // 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;
index 3f649b1..e5e1b23 100644 (file)
@@ -253,7 +253,7 @@ bool ConstString::Equals(ConstString lhs, ConstString rhs,
   // 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 @@ int ConstString::Compare(ConstString lhs, ConstString rhs,
     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);
     }
   }
 
index 39ad8fc..bea3c6d 100644 (file)
@@ -499,9 +499,9 @@ void FileSpec::MakeAbsolute(const FileSpec &dir) {
 void llvm::format_provider<FileSpec>::format(const FileSpec &F,
                                              raw_ostream &Stream,
                                              StringRef Style) {
-  assert(
-      (Style.empty() || Style.equals_lower("F") || Style.equals_lower("D")) &&
-      "Invalid FileSpec style!");
+  assert((Style.empty() || Style.equals_insensitive("F") ||
+          Style.equals_insensitive("D")) &&
+         "Invalid FileSpec style!");
 
   StringRef dir = F.GetDirectory().GetStringRef();
   StringRef file = F.GetFilename().GetStringRef();
@@ -511,7 +511,7 @@ void llvm::format_provider<FileSpec>::format(const FileSpec &F,
     return;
   }
 
-  if (Style.equals_lower("F")) {
+  if (Style.equals_insensitive("F")) {
     Stream << (file.empty() ? "(empty)" : file);
     return;
   }
@@ -527,7 +527,7 @@ void llvm::format_provider<FileSpec>::format(const FileSpec &F,
     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)";
index 1e19208..ff654ec 100644 (file)
@@ -60,17 +60,18 @@ uint32_t Log::GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &
   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); });
+    auto cat = llvm::find_if(entry.second.m_channel.categories,
+                             [&](const Log::Category &c) {
+                               return c.name.equals_insensitive(category);
+                             });
     if (cat != entry.second.m_channel.categories.end()) {
       flags |= cat->flag;
       continue;