This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGbbea361039c1: [lldb][NFC] Remove all uses of StringRef::withNullAsEmpty in LLDB (authored by teemperor). Herald added a subscriber: lldb-commits.
Changed prior to commit: https://reviews.llvm.org/D102597?vs=345772&id=346064#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102597/new/ https://reviews.llvm.org/D102597 Files: lldb/include/lldb/Interpreter/OptionValueRegex.h lldb/include/lldb/Interpreter/OptionValueString.h lldb/source/API/SBDebugger.cpp lldb/source/API/SBLanguageRuntime.cpp lldb/source/API/SBPlatform.cpp lldb/source/API/SBTypeCategory.cpp lldb/source/Breakpoint/BreakpointResolverName.cpp lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Commands/CommandObjectType.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Interpreter/OptionValue.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/source/Target/ThreadPlanStepInRange.cpp
Index: lldb/source/Target/ThreadPlanStepInRange.cpp =================================================================== --- lldb/source/Target/ThreadPlanStepInRange.cpp +++ lldb/source/Target/ThreadPlanStepInRange.cpp @@ -291,11 +291,10 @@ } void ThreadPlanStepInRange::SetAvoidRegexp(const char *name) { - auto name_ref = llvm::StringRef::withNullAsEmpty(name); if (m_avoid_regexp_up) - *m_avoid_regexp_up = RegularExpression(name_ref); + *m_avoid_regexp_up = RegularExpression(name); else - m_avoid_regexp_up = std::make_unique<RegularExpression>(name_ref); + m_avoid_regexp_up = std::make_unique<RegularExpression>(name); } void ThreadPlanStepInRange::SetDefaultFlagValue(uint32_t new_value) { Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -663,8 +663,8 @@ case 0: break; case 1: { - regex_up = std::make_unique<RegularExpression>( - llvm::StringRef::withNullAsEmpty(command.GetArgumentAtIndex(0))); + regex_up = + std::make_unique<RegularExpression>(command.GetArgumentAtIndex(0)); if (!regex_up->IsValid()) { result.AppendError( "invalid argument - please provide a valid regular expression"); Index: lldb/source/Interpreter/OptionValue.cpp =================================================================== --- lldb/source/Interpreter/OptionValue.cpp +++ lldb/source/Interpreter/OptionValue.cpp @@ -543,8 +543,7 @@ } if (value_sp) - error = value_sp->SetValueFromString( - llvm::StringRef::withNullAsEmpty(value_cstr), eVarSetOperationAssign); + error = value_sp->SetValueFromString(value_cstr, eVarSetOperationAssign); else error.SetErrorString("unsupported type mask"); return value_sp; Index: lldb/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/source/Interpreter/CommandInterpreter.cpp +++ lldb/source/Interpreter/CommandInterpreter.cpp @@ -2986,9 +2986,9 @@ IOHandlerSP io_handler_sp( new IOHandlerEditline(debugger, IOHandler::Type::CommandList, "lldb", // Name of input reader for history - llvm::StringRef::withNullAsEmpty(prompt), // Prompt - llvm::StringRef(), // Continuation prompt - true, // Get multiple lines + llvm::StringRef(prompt), // Prompt + llvm::StringRef(), // Continuation prompt + true, // Get multiple lines debugger.GetUseColor(), 0, // Don't show line numbers delegate, // IOHandlerDelegate @@ -3006,9 +3006,9 @@ IOHandlerSP io_handler_sp( new IOHandlerEditline(debugger, IOHandler::Type::PythonCode, "lldb-python", // Name of input reader for history - llvm::StringRef::withNullAsEmpty(prompt), // Prompt - llvm::StringRef(), // Continuation prompt - true, // Get multiple lines + llvm::StringRef(prompt), // Prompt + llvm::StringRef(), // Continuation prompt + true, // Get multiple lines debugger.GetUseColor(), 0, // Don't show line numbers delegate, // IOHandlerDelegate Index: lldb/source/Commands/CommandObjectType.cpp =================================================================== --- lldb/source/Commands/CommandObjectType.cpp +++ lldb/source/Commands/CommandObjectType.cpp @@ -1080,8 +1080,7 @@ if (argc == 1) { const char *arg = command.GetArgumentAtIndex(0); - formatter_regex = std::make_unique<RegularExpression>( - llvm::StringRef::withNullAsEmpty(arg)); + formatter_regex = std::make_unique<RegularExpression>(arg); if (!formatter_regex->IsValid()) { result.AppendErrorWithFormat("syntax error in regular expression '%s'", arg); @@ -1167,9 +1166,7 @@ bool escape = true; if (category->GetName() == category_regex->GetText()) { escape = false; - } else if (category_regex->Execute( - llvm::StringRef::withNullAsEmpty( - category->GetName()))) { + } else if (category_regex->Execute(category->GetName())) { escape = false; } @@ -2175,8 +2172,7 @@ if (argc == 1) { const char *arg = command.GetArgumentAtIndex(0); - regex = std::make_unique<RegularExpression>( - llvm::StringRef::withNullAsEmpty(arg)); + regex = std::make_unique<RegularExpression>(arg); if (!regex->IsValid()) { result.AppendErrorWithFormat( "syntax error in category regular expression '%s'", arg); @@ -2196,8 +2192,7 @@ bool escape = true; if (regex->GetText() == category_sp->GetName()) { escape = false; - } else if (regex->Execute(llvm::StringRef::withNullAsEmpty( - category_sp->GetName()))) { + } else if (regex->Execute(category_sp->GetName())) { escape = false; } Index: lldb/source/Commands/CommandObjectTarget.cpp =================================================================== --- lldb/source/Commands/CommandObjectTarget.cpp +++ lldb/source/Commands/CommandObjectTarget.cpp @@ -848,8 +848,7 @@ size_t matches = 0; bool use_var_name = false; if (m_option_variable.use_regex) { - RegularExpression regex( - llvm::StringRef::withNullAsEmpty(arg.c_str())); + RegularExpression regex(arg.ref()); if (!regex.IsValid()) { result.GetErrorStream().Printf( "error: invalid regular expression: '%s'\n", arg.c_str()); Index: lldb/source/Commands/CommandObjectFrame.cpp =================================================================== --- lldb/source/Commands/CommandObjectFrame.cpp +++ lldb/source/Commands/CommandObjectFrame.cpp @@ -460,7 +460,7 @@ protected: llvm::StringRef GetScopeString(VariableSP var_sp) { if (!var_sp) - return llvm::StringRef::withNullAsEmpty(nullptr); + return llvm::StringRef(); switch (var_sp->GetScope()) { case eValueTypeVariableGlobal: @@ -477,7 +477,7 @@ break; } - return llvm::StringRef::withNullAsEmpty(nullptr); + return llvm::StringRef(); } bool DoExecute(Args &command, CommandReturnObject &result) override { Index: lldb/source/Breakpoint/BreakpointResolverName.cpp =================================================================== --- lldb/source/Breakpoint/BreakpointResolverName.cpp +++ lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -31,7 +31,7 @@ m_class_name(), m_regex(), m_match_type(type), m_language(language), m_skip_prologue(skip_prologue) { if (m_match_type == Breakpoint::Regexp) { - m_regex = RegularExpression(llvm::StringRef::withNullAsEmpty(name_cstr)); + m_regex = RegularExpression(name_cstr); if (!m_regex.IsValid()) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); Index: lldb/source/API/SBTypeCategory.cpp =================================================================== --- lldb/source/API/SBTypeCategory.cpp +++ lldb/source/API/SBTypeCategory.cpp @@ -363,9 +363,7 @@ if (type_name.IsRegex()) m_opaque_sp->GetRegexTypeFormatsContainer()->Add( - RegularExpression( - llvm::StringRef::withNullAsEmpty(type_name.GetName())), - format.GetSP()); + RegularExpression(type_name.GetName()), format.GetSP()); else m_opaque_sp->GetTypeFormatsContainer()->Add( ConstString(type_name.GetName()), format.GetSP()); @@ -442,9 +440,7 @@ if (type_name.IsRegex()) m_opaque_sp->GetRegexTypeSummariesContainer()->Add( - RegularExpression( - llvm::StringRef::withNullAsEmpty(type_name.GetName())), - summary.GetSP()); + RegularExpression(type_name.GetName()), summary.GetSP()); else m_opaque_sp->GetTypeSummariesContainer()->Add( ConstString(type_name.GetName()), summary.GetSP()); @@ -487,9 +483,7 @@ if (type_name.IsRegex()) m_opaque_sp->GetRegexTypeFiltersContainer()->Add( - RegularExpression( - llvm::StringRef::withNullAsEmpty(type_name.GetName())), - filter.GetSP()); + RegularExpression(type_name.GetName()), filter.GetSP()); else m_opaque_sp->GetTypeFiltersContainer()->Add( ConstString(type_name.GetName()), filter.GetSP()); @@ -566,9 +560,7 @@ if (type_name.IsRegex()) m_opaque_sp->GetRegexTypeSyntheticsContainer()->Add( - RegularExpression( - llvm::StringRef::withNullAsEmpty(type_name.GetName())), - synth.GetSP()); + RegularExpression(type_name.GetName()), synth.GetSP()); else m_opaque_sp->GetTypeSyntheticsContainer()->Add( ConstString(type_name.GetName()), synth.GetSP()); Index: lldb/source/API/SBPlatform.cpp =================================================================== --- lldb/source/API/SBPlatform.cpp +++ lldb/source/API/SBPlatform.cpp @@ -413,8 +413,7 @@ PlatformSP platform_sp(GetSP()); if (platform_sp && connect_options.GetURL()) { Args args; - args.AppendArgument( - llvm::StringRef::withNullAsEmpty(connect_options.GetURL())); + args.AppendArgument(connect_options.GetURL()); sb_error.ref() = platform_sp->ConnectRemote(args); } else { sb_error.SetErrorString("invalid platform"); Index: lldb/source/API/SBLanguageRuntime.cpp =================================================================== --- lldb/source/API/SBLanguageRuntime.cpp +++ lldb/source/API/SBLanguageRuntime.cpp @@ -18,8 +18,7 @@ LLDB_RECORD_STATIC_METHOD(lldb::LanguageType, SBLanguageRuntime, GetLanguageTypeFromString, (const char *), string); - return Language::GetLanguageTypeFromString( - llvm::StringRef::withNullAsEmpty(string)); + return Language::GetLanguageTypeFromString(llvm::StringRef(string)); } const char * Index: lldb/source/API/SBDebugger.cpp =================================================================== --- lldb/source/API/SBDebugger.cpp +++ lldb/source/API/SBDebugger.cpp @@ -1387,7 +1387,7 @@ LLDB_RECORD_METHOD(void, SBDebugger, SetPrompt, (const char *), prompt); if (m_opaque_sp) - m_opaque_sp->SetPrompt(llvm::StringRef::withNullAsEmpty(prompt)); + m_opaque_sp->SetPrompt(llvm::StringRef(prompt)); } const char *SBDebugger::GetReproducerPath() const { Index: lldb/include/lldb/Interpreter/OptionValueString.h =================================================================== --- lldb/include/lldb/Interpreter/OptionValueString.h +++ lldb/include/lldb/Interpreter/OptionValueString.h @@ -85,7 +85,7 @@ const Flags &GetOptions() const { return m_options; } const char *operator=(const char *value) { - SetCurrentValue(llvm::StringRef::withNullAsEmpty(value)); + SetCurrentValue(value); return m_current_value.c_str(); } Index: lldb/include/lldb/Interpreter/OptionValueRegex.h =================================================================== --- lldb/include/lldb/Interpreter/OptionValueRegex.h +++ lldb/include/lldb/Interpreter/OptionValueRegex.h @@ -17,8 +17,7 @@ class OptionValueRegex : public Cloneable<OptionValueRegex, OptionValue> { public: OptionValueRegex(const char *value = nullptr) - : m_regex(llvm::StringRef::withNullAsEmpty(value)), - m_default_regex_str(llvm::StringRef::withNullAsEmpty(value).str()) {} + : m_regex(value), m_default_regex_str(value) {} ~OptionValueRegex() override = default;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits