From e50f9c419a84d1e58c38aa660c445395ad8056e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Thu, 24 Jun 2021 11:06:42 +0300 Subject: [PATCH] [lldb] Rename StringRef _lower() method calls to _insensitive() --- lldb/source/Commands/CommandObjectMultiword.cpp | 2 +- lldb/source/Host/common/NativeRegisterContext.cpp | 4 ++-- lldb/source/Host/windows/ProcessLauncherWindows.cpp | 2 +- lldb/source/Initialization/SystemInitializerCommon.cpp | 2 +- lldb/source/Interpreter/CommandInterpreter.cpp | 2 +- lldb/source/Interpreter/CommandObject.cpp | 8 ++++---- lldb/source/Interpreter/OptionArgParser.cpp | 16 ++++++++-------- lldb/source/Interpreter/OptionValueProperties.cpp | 4 ++-- lldb/source/Interpreter/ScriptInterpreter.cpp | 6 +++--- .../Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | 2 +- lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp | 2 +- .../Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp | 2 +- .../Plugins/Process/Windows/Common/ProcessWindows.cpp | 8 ++++---- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp | 2 +- .../Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp | 2 +- .../NativePDB/PdbFPOProgramToDWARFExpression.cpp | 2 +- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 6 ++++-- lldb/source/Target/Language.cpp | 2 +- lldb/source/Target/RegisterContext.cpp | 4 ++-- lldb/source/Utility/ArchSpec.cpp | 2 +- lldb/source/Utility/ConstString.cpp | 4 ++-- lldb/source/Utility/FileSpec.cpp | 10 +++++----- lldb/source/Utility/Log.cpp | 11 ++++++----- 23 files changed, 54 insertions(+), 51 deletions(-) diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index 3eafd00..a523fd0 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -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(); } diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp index 9bb877f..c534c7ac 100644 --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -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; diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index bbfe4d0..fc8da14 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -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; } diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 004fdb1..f6012ed 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -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 diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 8a3a409..2e07ff5 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -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)) { diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 5fa8468..a7dcd56 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -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; } } diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp index 3dcb30e..93b01ab 100644 --- a/lldb/source/Interpreter/OptionArgParser.cpp +++ b/lldb/source/Interpreter/OptionArgParser.cpp @@ -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) diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index c1551bd..ae07379 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -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) { diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp index 3802f2d..7351143 100644 --- a/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -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; } diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index d946517..895fd55 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -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; } diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index 3fb0c9e..379c534 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -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; diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp index 0a4017e..3599785 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -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; diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp index 03a3354..379496b 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -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() { diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index ce2cbb1..5cb39cb 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -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; } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp index f25dc84..9f09c0a 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp @@ -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) { diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp index ecae767..4f570d5e 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp @@ -41,7 +41,7 @@ static uint32_t ResolveLLDBRegisterNum(llvm::StringRef reg_name, llvm::Triple::A 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 index 882e363..ee4b791 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -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 diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index a6010b7..4a2af26 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -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(L.type); } diff --git a/lldb/source/Target/RegisterContext.cpp b/lldb/source/Target/RegisterContext.cpp index 845d7b4..bd50a94 100644 --- a/lldb/source/Target/RegisterContext.cpp +++ b/lldb/source/Target/RegisterContext.cpp @@ -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; diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index 604131cd..0fec259 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -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; diff --git a/lldb/source/Utility/ConstString.cpp b/lldb/source/Utility/ConstString.cpp index 3f649b1..e5e1b23 100644 --- a/lldb/source/Utility/ConstString.cpp +++ b/lldb/source/Utility/ConstString.cpp @@ -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); } } diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index 39ad8fc..bea3c6d 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -499,9 +499,9 @@ void FileSpec::MakeAbsolute(const FileSpec &dir) { void llvm::format_provider::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::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::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)"; diff --git a/lldb/source/Utility/Log.cpp b/lldb/source/Utility/Log.cpp index 1e19208..ff654ec 100644 --- a/lldb/source/Utility/Log.cpp +++ b/lldb/source/Utility/Log.cpp @@ -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; -- 2.7.4