Skip to content

Commit e50f9c4

Browse files
committed
[lldb] Rename StringRef _lower() method calls to _insensitive()
1 parent 3c6f8ca commit e50f9c4

23 files changed

+54
-51
lines changed

lldb/source/Commands/CommandObjectMultiword.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ bool CommandObjectMultiword::Execute(const char *args_string,
9898
return result.Succeeded();
9999
}
100100

101-
if (sub_command.equals_lower("help")) {
101+
if (sub_command.equals_insensitive("help")) {
102102
this->CommandObject::GenerateHelpText(result);
103103
return result.Succeeded();
104104
}

lldb/source/Host/common/NativeRegisterContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ NativeRegisterContext::GetRegisterInfoByName(llvm::StringRef reg_name,
6060
for (uint32_t reg = start_idx; reg < num_registers; ++reg) {
6161
const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg);
6262

63-
if (reg_name.equals_lower(reg_info->name) ||
64-
reg_name.equals_lower(reg_info->alt_name))
63+
if (reg_name.equals_insensitive(reg_info->name) ||
64+
reg_name.equals_insensitive(reg_info->alt_name))
6565
return reg_info;
6666
}
6767
return nullptr;

lldb/source/Host/windows/ProcessLauncherWindows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
8686
const char *hide_console_var =
8787
getenv("LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE");
8888
if (hide_console_var &&
89-
llvm::StringRef(hide_console_var).equals_lower("true")) {
89+
llvm::StringRef(hide_console_var).equals_insensitive("true")) {
9090
startupinfo.dwFlags |= STARTF_USESHOWWINDOW;
9191
startupinfo.wShowWindow = SW_HIDE;
9292
}

lldb/source/Initialization/SystemInitializerCommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ llvm::Error SystemInitializerCommon::Initialize() {
9696
#if defined(_WIN32)
9797
const char *disable_crash_dialog_var = getenv("LLDB_DISABLE_CRASH_DIALOG");
9898
if (disable_crash_dialog_var &&
99-
llvm::StringRef(disable_crash_dialog_var).equals_lower("true")) {
99+
llvm::StringRef(disable_crash_dialog_var).equals_insensitive("true")) {
100100
// This will prevent Windows from displaying a dialog box requiring user
101101
// interaction when
102102
// LLDB crashes. This is mostly useful when automating LLDB, for example

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2675,7 +2675,7 @@ void CommandInterpreter::FindCommandsForApropos(
26752675
const bool search_long_help = false;
26762676
const bool search_syntax = false;
26772677
const bool search_options = false;
2678-
if (command_name.contains_lower(search_word) ||
2678+
if (command_name.contains_insensitive(search_word) ||
26792679
cmd_obj->HelpTextContainsWord(search_word, search_short_help,
26802680
search_long_help, search_syntax,
26812681
search_options)) {

lldb/source/Interpreter/CommandObject.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,11 @@ bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
316316
llvm::StringRef long_help = GetHelpLong();
317317
llvm::StringRef syntax_help = GetSyntax();
318318

319-
if (search_short_help && short_help.contains_lower(search_word))
319+
if (search_short_help && short_help.contains_insensitive(search_word))
320320
found_word = true;
321-
else if (search_long_help && long_help.contains_lower(search_word))
321+
else if (search_long_help && long_help.contains_insensitive(search_word))
322322
found_word = true;
323-
else if (search_syntax && syntax_help.contains_lower(search_word))
323+
else if (search_syntax && syntax_help.contains_insensitive(search_word))
324324
found_word = true;
325325

326326
if (!found_word && search_options && GetOptions() != nullptr) {
@@ -330,7 +330,7 @@ bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
330330
GetCommandInterpreter().GetDebugger().GetTerminalWidth());
331331
if (!usage_help.Empty()) {
332332
llvm::StringRef usage_text = usage_help.GetString();
333-
if (usage_text.contains_lower(search_word))
333+
if (usage_text.contains_insensitive(search_word))
334334
found_word = true;
335335
}
336336
}

lldb/source/Interpreter/OptionArgParser.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ bool OptionArgParser::ToBoolean(llvm::StringRef ref, bool fail_value,
2020
if (success_ptr)
2121
*success_ptr = true;
2222
ref = ref.trim();
23-
if (ref.equals_lower("false") || ref.equals_lower("off") ||
24-
ref.equals_lower("no") || ref.equals_lower("0")) {
23+
if (ref.equals_insensitive("false") || ref.equals_insensitive("off") ||
24+
ref.equals_insensitive("no") || ref.equals_insensitive("0")) {
2525
return false;
26-
} else if (ref.equals_lower("true") || ref.equals_lower("on") ||
27-
ref.equals_lower("yes") || ref.equals_lower("1")) {
26+
} else if (ref.equals_insensitive("true") || ref.equals_insensitive("on") ||
27+
ref.equals_insensitive("yes") || ref.equals_insensitive("1")) {
2828
return true;
2929
}
3030
if (success_ptr)
@@ -125,13 +125,13 @@ lldb::ScriptLanguage OptionArgParser::ToScriptLanguage(
125125
if (success_ptr)
126126
*success_ptr = true;
127127

128-
if (s.equals_lower("python"))
128+
if (s.equals_insensitive("python"))
129129
return eScriptLanguagePython;
130-
if (s.equals_lower("lua"))
130+
if (s.equals_insensitive("lua"))
131131
return eScriptLanguageLua;
132-
if (s.equals_lower("default"))
132+
if (s.equals_insensitive("default"))
133133
return eScriptLanguageDefault;
134-
if (s.equals_lower("none"))
134+
if (s.equals_insensitive("none"))
135135
return eScriptLanguageNone;
136136

137137
if (success_ptr)

lldb/source/Interpreter/OptionValueProperties.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,11 @@ void OptionValueProperties::Apropos(
630630
} else {
631631
bool match = false;
632632
llvm::StringRef name = property->GetName();
633-
if (name.contains_lower(keyword))
633+
if (name.contains_insensitive(keyword))
634634
match = true;
635635
else {
636636
llvm::StringRef desc = property->GetDescription();
637-
if (desc.contains_lower(keyword))
637+
if (desc.contains_insensitive(keyword))
638638
match = true;
639639
}
640640
if (match) {

lldb/source/Interpreter/ScriptInterpreter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ ScriptInterpreter::GetStatusFromSBError(const lldb::SBError &error) const {
8585

8686
lldb::ScriptLanguage
8787
ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) {
88-
if (language.equals_lower(LanguageToString(eScriptLanguageNone)))
88+
if (language.equals_insensitive(LanguageToString(eScriptLanguageNone)))
8989
return eScriptLanguageNone;
90-
if (language.equals_lower(LanguageToString(eScriptLanguagePython)))
90+
if (language.equals_insensitive(LanguageToString(eScriptLanguagePython)))
9191
return eScriptLanguagePython;
92-
if (language.equals_lower(LanguageToString(eScriptLanguageLua)))
92+
if (language.equals_insensitive(LanguageToString(eScriptLanguageLua)))
9393
return eScriptLanguageLua;
9494
return eScriptLanguageUnknown;
9595
}

lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ bool CPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const {
11521152
const auto suffixes = {".cpp", ".cxx", ".c++", ".cc", ".c",
11531153
".h", ".hh", ".hpp", ".hxx", ".h++"};
11541154
for (auto suffix : suffixes) {
1155-
if (file_path.endswith_lower(suffix))
1155+
if (file_path.endswith_insensitive(suffix))
11561156
return true;
11571157
}
11581158

lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ bool ObjCLanguage::IsNilReference(ValueObject &valobj) {
11341134
bool ObjCLanguage::IsSourceFile(llvm::StringRef file_path) const {
11351135
const auto suffixes = {".h", ".m", ".M"};
11361136
for (auto suffix : suffixes) {
1137-
if (file_path.endswith_lower(suffix))
1137+
if (file_path.endswith_insensitive(suffix))
11381138
return true;
11391139
}
11401140
return false;

lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LLDB_PLUGIN_DEFINE(ObjCPlusPlusLanguage)
1919
bool ObjCPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const {
2020
const auto suffixes = {".h", ".mm"};
2121
for (auto suffix : suffixes) {
22-
if (file_path.endswith_lower(suffix))
22+
if (file_path.endswith_insensitive(suffix))
2323
return true;
2424
}
2525
return false;

lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ ProcessSP ProcessWindows::CreateInstance(lldb::TargetSP target_sp,
8686

8787
static bool ShouldUseLLDBServer() {
8888
llvm::StringRef use_lldb_server = ::getenv("LLDB_USE_LLDB_SERVER");
89-
return use_lldb_server.equals_lower("on") ||
90-
use_lldb_server.equals_lower("yes") ||
91-
use_lldb_server.equals_lower("1") ||
92-
use_lldb_server.equals_lower("true");
89+
return use_lldb_server.equals_insensitive("on") ||
90+
use_lldb_server.equals_insensitive("yes") ||
91+
use_lldb_server.equals_insensitive("1") ||
92+
use_lldb_server.equals_insensitive("true");
9393
}
9494

9595
void ProcessWindows::Initialize() {

lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ void ProcessMinidump::ReadModuleList() {
548548

549549
// check if the process is wow64 - a 32 bit windows process running on a
550550
// 64 bit windows
551-
if (llvm::StringRef(name).endswith_lower("wow64.dll")) {
551+
if (llvm::StringRef(name).endswith_insensitive("wow64.dll")) {
552552
m_is_wow64 = true;
553553
}
554554

lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static bool IsMainFile(llvm::StringRef main, llvm::StringRef other) {
4343

4444
llvm::SmallString<64> normalized(other);
4545
llvm::sys::path::native(normalized);
46-
return main.equals_lower(normalized);
46+
return main.equals_insensitive(normalized);
4747
}
4848

4949
static void ParseCompile3(const CVSymbol &sym, CompilandIndexItem &cci) {

lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static uint32_t ResolveLLDBRegisterNum(llvm::StringRef reg_name, llvm::Triple::A
4141
auto it = llvm::find_if(
4242
register_names,
4343
[&reg_name](const llvm::EnumEntry<uint16_t> &register_entry) {
44-
return reg_name.compare_lower(register_entry.Name) == 0;
44+
return reg_name.compare_insensitive(register_entry.Name) == 0;
4545
});
4646

4747
if (it == register_names.end())

lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ bool ShouldAddLine(uint32_t requested_line, uint32_t actual_line,
8484
static bool ShouldUseNativeReader() {
8585
#if defined(_WIN32)
8686
llvm::StringRef use_native = ::getenv("LLDB_USE_NATIVE_PDB_READER");
87-
return use_native.equals_lower("on") || use_native.equals_lower("yes") ||
88-
use_native.equals_lower("1") || use_native.equals_lower("true");
87+
return use_native.equals_insensitive("on") ||
88+
use_native.equals_insensitive("yes") ||
89+
use_native.equals_insensitive("1") ||
90+
use_native.equals_insensitive("true");
8991
#else
9092
return true;
9193
#endif

lldb/source/Target/Language.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static uint32_t num_languages =
196196

197197
LanguageType Language::GetLanguageTypeFromString(llvm::StringRef string) {
198198
for (const auto &L : language_names) {
199-
if (string.equals_lower(L.name))
199+
if (string.equals_insensitive(L.name))
200200
return static_cast<LanguageType>(L.type);
201201
}
202202

lldb/source/Target/RegisterContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ RegisterContext::GetRegisterInfoByName(llvm::StringRef reg_name,
5858
for (uint32_t reg = start_idx; reg < num_registers; ++reg) {
5959
const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg);
6060

61-
if (reg_name.equals_lower(reg_info->name) ||
62-
reg_name.equals_lower(reg_info->alt_name))
61+
if (reg_name.equals_insensitive(reg_info->name) ||
62+
reg_name.equals_insensitive(reg_info->alt_name))
6363
return reg_info;
6464
}
6565
return nullptr;

lldb/source/Utility/ArchSpec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ static const ArchDefinition *FindArchDefinition(ArchitectureType arch_type) {
464464
// Get an architecture definition by name.
465465
static const CoreDefinition *FindCoreDefinition(llvm::StringRef name) {
466466
for (unsigned int i = 0; i < llvm::array_lengthof(g_core_definitions); ++i) {
467-
if (name.equals_lower(g_core_definitions[i].name))
467+
if (name.equals_insensitive(g_core_definitions[i].name))
468468
return &g_core_definitions[i];
469469
}
470470
return nullptr;

lldb/source/Utility/ConstString.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ bool ConstString::Equals(ConstString lhs, ConstString rhs,
253253
// perform case insensitive equality test
254254
llvm::StringRef lhs_string_ref(lhs.GetStringRef());
255255
llvm::StringRef rhs_string_ref(rhs.GetStringRef());
256-
return lhs_string_ref.equals_lower(rhs_string_ref);
256+
return lhs_string_ref.equals_insensitive(rhs_string_ref);
257257
}
258258

259259
int ConstString::Compare(ConstString lhs, ConstString rhs,
@@ -270,7 +270,7 @@ int ConstString::Compare(ConstString lhs, ConstString rhs,
270270
if (case_sensitive) {
271271
return lhs_string_ref.compare(rhs_string_ref);
272272
} else {
273-
return lhs_string_ref.compare_lower(rhs_string_ref);
273+
return lhs_string_ref.compare_insensitive(rhs_string_ref);
274274
}
275275
}
276276

lldb/source/Utility/FileSpec.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,9 @@ void FileSpec::MakeAbsolute(const FileSpec &dir) {
499499
void llvm::format_provider<FileSpec>::format(const FileSpec &F,
500500
raw_ostream &Stream,
501501
StringRef Style) {
502-
assert(
503-
(Style.empty() || Style.equals_lower("F") || Style.equals_lower("D")) &&
504-
"Invalid FileSpec style!");
502+
assert((Style.empty() || Style.equals_insensitive("F") ||
503+
Style.equals_insensitive("D")) &&
504+
"Invalid FileSpec style!");
505505

506506
StringRef dir = F.GetDirectory().GetStringRef();
507507
StringRef file = F.GetFilename().GetStringRef();
@@ -511,7 +511,7 @@ void llvm::format_provider<FileSpec>::format(const FileSpec &F,
511511
return;
512512
}
513513

514-
if (Style.equals_lower("F")) {
514+
if (Style.equals_insensitive("F")) {
515515
Stream << (file.empty() ? "(empty)" : file);
516516
return;
517517
}
@@ -527,7 +527,7 @@ void llvm::format_provider<FileSpec>::format(const FileSpec &F,
527527
Stream << GetPreferredPathSeparator(F.GetPathStyle());
528528
}
529529

530-
if (Style.equals_lower("D")) {
530+
if (Style.equals_insensitive("D")) {
531531
// We only want to print the directory, so now just exit.
532532
if (dir.empty())
533533
Stream << "(empty)";

lldb/source/Utility/Log.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@ uint32_t Log::GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &
6060
bool list_categories = false;
6161
uint32_t flags = 0;
6262
for (const char *category : categories) {
63-
if (llvm::StringRef("all").equals_lower(category)) {
63+
if (llvm::StringRef("all").equals_insensitive(category)) {
6464
flags |= UINT32_MAX;
6565
continue;
6666
}
67-
if (llvm::StringRef("default").equals_lower(category)) {
67+
if (llvm::StringRef("default").equals_insensitive(category)) {
6868
flags |= entry.second.m_channel.default_flags;
6969
continue;
7070
}
71-
auto cat = llvm::find_if(
72-
entry.second.m_channel.categories,
73-
[&](const Log::Category &c) { return c.name.equals_lower(category); });
71+
auto cat = llvm::find_if(entry.second.m_channel.categories,
72+
[&](const Log::Category &c) {
73+
return c.name.equals_insensitive(category);
74+
});
7475
if (cat != entry.second.m_channel.categories.end()) {
7576
flags |= cat->flag;
7677
continue;

0 commit comments

Comments
 (0)