Author: zturner Date: Fri Sep 23 13:06:53 2016 New Revision: 282269 URL: http://llvm.org/viewvc/llvm-project?rev=282269&view=rev Log: Update the prompt related functions to use StringRefs.
Modified: lldb/trunk/include/lldb/Core/Debugger.h lldb/trunk/include/lldb/Core/Event.h lldb/trunk/include/lldb/Core/IOHandler.h lldb/trunk/include/lldb/Core/Log.h lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h lldb/trunk/include/lldb/Interpreter/OptionValue.h lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h lldb/trunk/include/lldb/Utility/AnsiTerminal.h lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/Commands/CommandObjectCommands.cpp lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/Event.cpp lldb/trunk/source/Core/IOHandler.cpp lldb/trunk/source/Expression/REPL.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValue.cpp lldb/trunk/source/Interpreter/OptionValueProperties.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/Core/Debugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Debugger.h (original) +++ lldb/trunk/include/lldb/Core/Debugger.h Fri Sep 23 13:06:53 2016 @@ -226,9 +226,10 @@ public: bool SetTerminalWidth(uint32_t term_width); - const char *GetPrompt() const; + llvm::StringRef GetPrompt() const; - void SetPrompt(const char *p); + void SetPrompt(llvm::StringRef p); + void SetPrompt(const char *) = delete; bool GetUseExternalEditor() const; Modified: lldb/trunk/include/lldb/Core/Event.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Event.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Event.h (original) +++ lldb/trunk/include/lldb/Core/Event.h Fri Sep 23 13:06:53 2016 @@ -59,6 +59,8 @@ public: EventDataBytes(const char *cstr); + EventDataBytes(llvm::StringRef str); + EventDataBytes(const void *src, size_t src_len); ~EventDataBytes() override; Modified: lldb/trunk/include/lldb/Core/IOHandler.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/IOHandler.h (original) +++ lldb/trunk/include/lldb/Core/IOHandler.h Fri Sep 23 13:06:53 2016 @@ -97,10 +97,11 @@ public: return nullptr; } - virtual bool SetPrompt(const char *prompt) { + virtual bool SetPrompt(llvm::StringRef prompt) { // Prompt support isn't mandatory return false; } + bool SetPrompt(const char *) = delete; virtual ConstString GetControlSequence(char ch) { return ConstString(); } @@ -341,7 +342,7 @@ class IOHandlerEditline : public IOHandl public: IOHandlerEditline(Debugger &debugger, IOHandler::Type type, const char *editline_name, // Used for saving history files - const char *prompt, const char *continuation_prompt, + llvm::StringRef prompt, llvm::StringRef continuation_prompt, bool multi_line, bool color_prompts, uint32_t line_number_start, // If non-zero show line numbers // starting at @@ -353,13 +354,22 @@ public: const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, uint32_t flags, const char *editline_name, // Used for saving history files - const char *prompt, const char *continuation_prompt, + llvm::StringRef prompt, llvm::StringRef continuation_prompt, bool multi_line, bool color_prompts, uint32_t line_number_start, // If non-zero show line numbers // starting at // 'line_number_start' IOHandlerDelegate &delegate); + IOHandlerEditline(Debugger &, IOHandler::Type, const char *, const char *, + const char *, bool, bool, uint32_t, + IOHandlerDelegate &) = delete; + + IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &, + const lldb::StreamFileSP &, const lldb::StreamFileSP &, + uint32_t, const char *, const char *, const char *, bool, + bool, uint32_t, IOHandlerDelegate &) = delete; + ~IOHandlerEditline() override; void Run() override; @@ -388,11 +398,13 @@ public: const char *GetPrompt() override; - bool SetPrompt(const char *prompt) override; + bool SetPrompt(llvm::StringRef prompt) override; + bool SetPrompt(const char *prompt) = delete; const char *GetContinuationPrompt(); - void SetContinuationPrompt(const char *prompt); + void SetContinuationPrompt(llvm::StringRef prompt); + void SetContinuationPrompt(const char *) = delete; bool GetLine(std::string &line, bool &interrupted); Modified: lldb/trunk/include/lldb/Core/Log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Log.h (original) +++ lldb/trunk/include/lldb/Core/Log.h Fri Sep 23 13:06:53 2016 @@ -106,6 +106,7 @@ public: virtual void PutCString(const char *cstr); + // CLEANUP: Add llvm::raw_ostream &Stream() function. virtual void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Fri Sep 23 13:06:53 2016 @@ -372,7 +372,8 @@ public: const char *ProcessEmbeddedScriptCommands(const char *arg); - void UpdatePrompt(const char *); + void UpdatePrompt(llvm::StringRef prompt); + void UpdatePrompt(const char *) = delete; bool Confirm(const char *message, bool default_answer); Modified: lldb/trunk/include/lldb/Interpreter/OptionValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValue.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValue.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionValue.h Fri Sep 23 13:06:53 2016 @@ -301,7 +301,7 @@ public: const char *GetStringValue(const char *fail_value = nullptr) const; - bool SetStringValue(const char *new_value); + bool SetStringValue(llvm::StringRef new_value); uint64_t GetUInt64Value(uint64_t fail_value = 0) const; Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Fri Sep 23 13:06:53 2016 @@ -187,8 +187,11 @@ public: uint32_t idx, const char *fail_value) const; + bool SetPropertyAtIndexAsString(const ExecutionContext *, uint32_t, + const char *) = delete; + bool SetPropertyAtIndexAsString(const ExecutionContext *exe_ctx, uint32_t idx, - const char *new_value); + llvm::StringRef new_value); OptionValueString * GetPropertyAtIndexAsOptionValueString(const ExecutionContext *exe_ctx, Modified: lldb/trunk/include/lldb/Utility/AnsiTerminal.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/AnsiTerminal.h?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/AnsiTerminal.h (original) +++ lldb/trunk/include/lldb/Utility/AnsiTerminal.h Fri Sep 23 13:06:53 2016 @@ -50,11 +50,16 @@ #define ANSI_1_CTRL(ctrl1) "\033["##ctrl1 ANSI_ESC_END #define ANSI_2_CTRL(ctrl1, ctrl2) "\033["##ctrl1 ";"##ctrl2 ANSI_ESC_END +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" + +#include <string> + namespace lldb_utility { namespace ansi { -inline std::string FormatAnsiTerminalCodes(const char *format, +inline std::string FormatAnsiTerminalCodes(llvm::StringRef format, bool do_color = true) { // Convert "${ansi.XXX}" tokens to ansi values or clear them if do_color is // false. @@ -97,30 +102,33 @@ inline std::string FormatAnsiTerminalCod #undef _TO_STR #undef _TO_STR2 }; + auto codes = llvm::makeArrayRef(g_color_tokens); + static const char tok_hdr[] = "${ansi."; std::string fmt; - for (const char *p = format; *p; ++p) { - const char *tok_start = strstr(p, tok_hdr); - if (!tok_start) { - fmt.append(p, strlen(p)); + while (!format.empty()) { + llvm::StringRef left, right; + std::tie(left, right) = format.split(tok_hdr); + + fmt.append(left); + + if (left == format && right.empty()) { + // The header was not found. Just exit. break; } - fmt.append(p, tok_start - p); - p = tok_start; - - const char *tok_str = tok_start + sizeof(tok_hdr) - 1; - for (size_t i = 0; i < sizeof(g_color_tokens) / sizeof(g_color_tokens[0]); - ++i) { - if (!strncmp(tok_str, g_color_tokens[i].name, - strlen(g_color_tokens[i].name))) { - if (do_color) - fmt.append(g_color_tokens[i].value); - p = tok_str + strlen(g_color_tokens[i].name) - 1; - break; - } + for (const auto &code : codes) { + if (!right.consume_front(code.name)) + continue; + + if (do_color) + fmt.append(code.value); + format = right; + break; } + + format = format.drop_front(); } return fmt; } Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Fri Sep 23 13:06:53 2016 @@ -930,14 +930,15 @@ const char *SBDebugger::GetPrompt() cons if (log) log->Printf("SBDebugger(%p)::GetPrompt () => \"%s\"", static_cast<void *>(m_opaque_sp.get()), - (m_opaque_sp ? m_opaque_sp->GetPrompt() : "")); + (m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : "")); - return (m_opaque_sp ? m_opaque_sp->GetPrompt() : nullptr); + return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString() + : nullptr); } void SBDebugger::SetPrompt(const char *prompt) { if (m_opaque_sp) - m_opaque_sp->SetPrompt(prompt); + m_opaque_sp->SetPrompt(llvm::StringRef::withNullAsEmpty(prompt)); } ScriptLanguage SBDebugger::GetScriptLanguage() const { Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Sep 23 13:06:53 2016 @@ -1077,9 +1077,9 @@ protected: const bool multiple_lines = true; // Get multiple lines IOHandlerSP io_handler_sp(new IOHandlerEditline( debugger, IOHandler::Type::Other, - "lldb-regex", // Name of input reader for history - "> ", // Prompt - nullptr, // Continuation prompt + "lldb-regex", // Name of input reader for history + llvm::StringRef("> "), // Prompt + llvm::StringRef(), // Continuation prompt multiple_lines, color_prompt, 0, // Don't show line numbers *this)); Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Sep 23 13:06:53 2016 @@ -482,8 +482,8 @@ void CommandObjectExpression::GetMultili IOHandlerSP io_handler_sp( new IOHandlerEditline(debugger, IOHandler::Type::Expression, "lldb-expr", // Name of input reader for history - nullptr, // No prompt - nullptr, // Continuation prompt + llvm::StringRef(), // No prompt + llvm::StringRef(), // Continuation prompt multiple_lines, color_prompt, 1, // Show line numbers starting at 1 *this)); Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Fri Sep 23 13:06:53 2016 @@ -276,7 +276,7 @@ Error Debugger::SetPropertyValue(const E if (error.Success()) { // FIXME it would be nice to have "on-change" callbacks for properties if (strcmp(property_path, g_properties[ePropertyPrompt].name) == 0) { - const char *new_prompt = GetPrompt(); + llvm::StringRef new_prompt = GetPrompt(); std::string str = lldb_utility::ansi::FormatAnsiTerminalCodes( new_prompt, GetUseColor()); if (str.length()) @@ -337,16 +337,16 @@ bool Debugger::GetNotifyVoid() const { nullptr, idx, g_properties[idx].default_uint_value != 0); } -const char *Debugger::GetPrompt() const { +llvm::StringRef Debugger::GetPrompt() const { const uint32_t idx = ePropertyPrompt; return m_collection_sp->GetPropertyAtIndexAsString( nullptr, idx, g_properties[idx].default_cstr_value); } -void Debugger::SetPrompt(const char *p) { +void Debugger::SetPrompt(llvm::StringRef p) { const uint32_t idx = ePropertyPrompt; m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, p); - const char *new_prompt = GetPrompt(); + llvm::StringRef new_prompt = GetPrompt(); std::string str = lldb_utility::ansi::FormatAnsiTerminalCodes(new_prompt, GetUseColor()); if (str.length()) Modified: lldb/trunk/source/Core/Event.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Event.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Core/Event.cpp (original) +++ lldb/trunk/source/Core/Event.cpp Fri Sep 23 13:06:53 2016 @@ -113,6 +113,10 @@ EventDataBytes::EventDataBytes(const cha SetBytesFromCString(cstr); } +EventDataBytes::EventDataBytes(llvm::StringRef str) : m_bytes() { + SetBytes(str.data(), str.size()); +} + EventDataBytes::EventDataBytes(const void *src, size_t src_len) : m_bytes() { SetBytes(src, src_len); } Modified: lldb/trunk/source/Core/IOHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Core/IOHandler.cpp (original) +++ lldb/trunk/source/Core/IOHandler.cpp Fri Sep 23 13:06:53 2016 @@ -132,10 +132,10 @@ IOHandlerConfirm::IOHandlerConfirm(Debug : IOHandlerEditline( debugger, IOHandler::Type::Confirm, nullptr, // nullptr editline_name means no history loaded/saved - nullptr, // No prompt - nullptr, // No continuation prompt - false, // Multi-line - false, // Don't colorize the prompt (i.e. the confirm message.) + llvm::StringRef(), // No prompt + llvm::StringRef(), // No continuation prompt + false, // Multi-line + false, // Don't colorize the prompt (i.e. the confirm message.) 0, *this), m_default_response(default_response), m_user_response(default_response) { StreamString prompt_stream; @@ -145,7 +145,7 @@ IOHandlerConfirm::IOHandlerConfirm(Debug else prompt_stream.Printf(": [y/N] "); - SetPrompt(prompt_stream.GetString().c_str()); + SetPrompt(prompt_stream.GetString()); } IOHandlerConfirm::~IOHandlerConfirm() = default; @@ -253,8 +253,9 @@ int IOHandlerDelegate::IOHandlerComplete IOHandlerEditline::IOHandlerEditline( Debugger &debugger, IOHandler::Type type, const char *editline_name, // Used for saving history files - const char *prompt, const char *continuation_prompt, bool multi_line, - bool color_prompts, uint32_t line_number_start, IOHandlerDelegate &delegate) + llvm::StringRef prompt, llvm::StringRef continuation_prompt, + bool multi_line, bool color_prompts, uint32_t line_number_start, + IOHandlerDelegate &delegate) : IOHandlerEditline(debugger, type, StreamFileSP(), // Inherit input from top input reader StreamFileSP(), // Inherit output from top input reader @@ -269,8 +270,9 @@ IOHandlerEditline::IOHandlerEditline( const lldb::StreamFileSP &input_sp, const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, uint32_t flags, const char *editline_name, // Used for saving history files - const char *prompt, const char *continuation_prompt, bool multi_line, - bool color_prompts, uint32_t line_number_start, IOHandlerDelegate &delegate) + llvm::StringRef prompt, llvm::StringRef continuation_prompt, + bool multi_line, bool color_prompts, uint32_t line_number_start, + IOHandlerDelegate &delegate) : IOHandler(debugger, type, input_sp, output_sp, error_sp, flags), #ifndef LLDB_DISABLE_LIBEDIT m_editline_ap(), @@ -305,7 +307,7 @@ IOHandlerEditline::IOHandlerEditline( } #endif SetBaseLineNumber(m_base_line_number); - SetPrompt(prompt ? prompt : ""); + SetPrompt(prompt); SetContinuationPrompt(continuation_prompt); } @@ -444,11 +446,9 @@ const char *IOHandlerEditline::GetPrompt return m_prompt.c_str(); } -bool IOHandlerEditline::SetPrompt(const char *p) { - if (p && p[0]) - m_prompt = p; - else - m_prompt.clear(); +bool IOHandlerEditline::SetPrompt(llvm::StringRef prompt) { + m_prompt = prompt; + #ifndef LLDB_DISABLE_LIBEDIT if (m_editline_ap) m_editline_ap->SetPrompt(m_prompt.empty() ? nullptr : m_prompt.c_str()); @@ -461,11 +461,8 @@ const char *IOHandlerEditline::GetContin : m_continuation_prompt.c_str()); } -void IOHandlerEditline::SetContinuationPrompt(const char *p) { - if (p && p[0]) - m_continuation_prompt = p; - else - m_continuation_prompt.clear(); +void IOHandlerEditline::SetContinuationPrompt(llvm::StringRef prompt) { + m_continuation_prompt = prompt; #ifndef LLDB_DISABLE_LIBEDIT if (m_editline_ap) Modified: lldb/trunk/source/Expression/REPL.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/REPL.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Expression/REPL.cpp (original) +++ lldb/trunk/source/Expression/REPL.cpp Fri Sep 23 13:06:53 2016 @@ -81,11 +81,11 @@ lldb::IOHandlerSP REPL::GetIOHandler() { m_io_handler_sp.reset( new IOHandlerEditline(debugger, IOHandler::Type::REPL, "lldb-repl", // Name of input reader for history - "> ", // prompt - ". ", // Continuation prompt - true, // Multi-line - true, // The REPL prompt is always colored - 1, // Line number + llvm::StringRef("> "), // prompt + llvm::StringRef(". "), // Continuation prompt + true, // Multi-line + true, // The REPL prompt is always colored + 1, // Line number *this)); // Don't exit if CTRL+C is pressed Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Sep 23 13:06:53 2016 @@ -1899,7 +1899,7 @@ int CommandInterpreter::HandleCompletion CommandInterpreter::~CommandInterpreter() {} -void CommandInterpreter::UpdatePrompt(const char *new_prompt) { +void CommandInterpreter::UpdatePrompt(llvm::StringRef new_prompt) { EventSP prompt_change_event_sp( new Event(eBroadcastBitResetPrompt, new EventDataBytes(new_prompt))); ; @@ -2238,7 +2238,9 @@ void CommandInterpreter::HandleCommands( continue; if (options.GetEchoCommands()) { - result.AppendMessageWithFormat("%s %s\n", m_debugger.GetPrompt(), cmd); + // TODO: Add Stream support. + result.AppendMessageWithFormat("%s %s\n", + m_debugger.GetPrompt().str().c_str(), cmd); } CommandReturnObject tmp_result; @@ -2461,7 +2463,7 @@ void CommandInterpreter::HandleCommandsF flags, nullptr, // Pass in NULL for "editline_name" so no history is saved, // or written - debugger.GetPrompt(), NULL, + debugger.GetPrompt(), llvm::StringRef(), false, // Not multi-line debugger.GetUseColor(), 0, *this)); const bool old_async_execution = debugger.GetAsyncExecution(); @@ -2824,9 +2826,9 @@ void CommandInterpreter::GetLLDBCommands IOHandlerSP io_handler_sp( new IOHandlerEditline(debugger, IOHandler::Type::CommandList, "lldb", // Name of input reader for history - prompt, // Prompt - NULL, // Continuation prompt - true, // Get multiple lines + llvm::StringRef::withNullAsEmpty(prompt), // Prompt + llvm::StringRef(), // Continuation prompt + true, // Get multiple lines debugger.GetUseColor(), 0, // Don't show line numbers delegate)); // IOHandlerDelegate @@ -2847,9 +2849,9 @@ void CommandInterpreter::GetPythonComman IOHandlerSP io_handler_sp( new IOHandlerEditline(debugger, IOHandler::Type::PythonCode, "lldb-python", // Name of input reader for history - prompt, // Prompt - NULL, // Continuation prompt - true, // Get multiple lines + llvm::StringRef::withNullAsEmpty(prompt), // Prompt + llvm::StringRef(), // Continuation prompt + true, // Get multiple lines debugger.GetUseColor(), 0, // Don't show line numbers delegate)); // IOHandlerDelegate @@ -2898,7 +2900,7 @@ CommandInterpreter::GetIOHandler(bool fo m_debugger, IOHandler::Type::CommandInterpreter, m_debugger.GetInputFile(), m_debugger.GetOutputFile(), m_debugger.GetErrorFile(), flags, "lldb", m_debugger.GetPrompt(), - NULL, // Continuation prompt + llvm::StringRef(), // Continuation prompt false, // Don't enable multiple line input, just single line commands m_debugger.GetUseColor(), 0, // Don't show line numbers Modified: lldb/trunk/source/Interpreter/OptionValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValue.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/OptionValue.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValue.cpp Fri Sep 23 13:06:53 2016 @@ -419,10 +419,10 @@ const char *OptionValue::GetStringValue( return fail_value; } -bool OptionValue::SetStringValue(const char *new_value) { +bool OptionValue::SetStringValue(llvm::StringRef new_value) { OptionValueString *option_value = GetAsString(); if (option_value) { - option_value->SetCurrentValue(llvm::StringRef::withNullAsEmpty(new_value)); + option_value->SetCurrentValue(new_value); return true; } return false; Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Fri Sep 23 13:06:53 2016 @@ -491,7 +491,7 @@ const char *OptionValueProperties::GetPr } bool OptionValueProperties::SetPropertyAtIndexAsString( - const ExecutionContext *exe_ctx, uint32_t idx, const char *new_value) { + const ExecutionContext *exe_ctx, uint32_t idx, llvm::StringRef new_value) { const Property *property = GetPropertyAtIndex(exe_ctx, true, idx); if (property) { OptionValue *value = property->GetValue().get(); Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=282269&r1=282268&r2=282269&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Fri Sep 23 13:06:53 2016 @@ -3701,7 +3701,8 @@ const char *TargetProperties::GetArg0() void TargetProperties::SetArg0(const char *arg) { const uint32_t idx = ePropertyArg0; - m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, arg); + m_collection_sp->SetPropertyAtIndexAsString( + nullptr, idx, llvm::StringRef::withNullAsEmpty(arg)); m_launch_info.SetArg0(arg); } @@ -3818,7 +3819,8 @@ FileSpec TargetProperties::GetStandardIn void TargetProperties::SetStandardInputPath(const char *p) { const uint32_t idx = ePropertyInputPath; - m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, p); + m_collection_sp->SetPropertyAtIndexAsString( + nullptr, idx, llvm::StringRef::withNullAsEmpty(p)); } FileSpec TargetProperties::GetStandardOutputPath() const { @@ -3828,7 +3830,8 @@ FileSpec TargetProperties::GetStandardOu void TargetProperties::SetStandardOutputPath(const char *p) { const uint32_t idx = ePropertyOutputPath; - m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, p); + m_collection_sp->SetPropertyAtIndexAsString( + nullptr, idx, llvm::StringRef::withNullAsEmpty(p)); } FileSpec TargetProperties::GetStandardErrorPath() const { @@ -3861,7 +3864,8 @@ const char *TargetProperties::GetExpress void TargetProperties::SetStandardErrorPath(const char *p) { const uint32_t idx = ePropertyErrorPath; - m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, p); + m_collection_sp->SetPropertyAtIndexAsString( + nullptr, idx, llvm::StringRef::withNullAsEmpty(p)); } bool TargetProperties::GetBreakpointsConsultPlatformAvoidList() { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits