summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-09-23 18:06:53 +0000
committerZachary Turner <zturner@google.com>2016-09-23 18:06:53 +0000
commit514d8cd83ea7408f7f4215a5f0233c6f10c7a1ca (patch)
treeaae2aa8aae6dc7bd2c941fa14b5fcae8a63a2281
parent0120e3f278a5a9db6fa7b0cad258b209b409fa09 (diff)
downloadbcm5719-llvm-514d8cd83ea7408f7f4215a5f0233c6f10c7a1ca.tar.gz
bcm5719-llvm-514d8cd83ea7408f7f4215a5f0233c6f10c7a1ca.zip
Update the prompt related functions to use StringRefs.
llvm-svn: 282269
-rw-r--r--lldb/include/lldb/Core/Debugger.h5
-rw-r--r--lldb/include/lldb/Core/Event.h2
-rw-r--r--lldb/include/lldb/Core/IOHandler.h22
-rw-r--r--lldb/include/lldb/Core/Log.h1
-rw-r--r--lldb/include/lldb/Interpreter/CommandInterpreter.h3
-rw-r--r--lldb/include/lldb/Interpreter/OptionValue.h2
-rw-r--r--lldb/include/lldb/Interpreter/OptionValueProperties.h5
-rw-r--r--lldb/include/lldb/Utility/AnsiTerminal.h44
-rw-r--r--lldb/source/API/SBDebugger.cpp7
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp6
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp4
-rw-r--r--lldb/source/Core/Debugger.cpp8
-rw-r--r--lldb/source/Core/Event.cpp4
-rw-r--r--lldb/source/Core/IOHandler.cpp37
-rw-r--r--lldb/source/Expression/REPL.cpp10
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp22
-rw-r--r--lldb/source/Interpreter/OptionValue.cpp4
-rw-r--r--lldb/source/Interpreter/OptionValueProperties.cpp2
-rw-r--r--lldb/source/Target/Target.cpp12
19 files changed, 118 insertions, 82 deletions
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index 573c10b0a0f..b6dfb507863 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -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;
diff --git a/lldb/include/lldb/Core/Event.h b/lldb/include/lldb/Core/Event.h
index cec9b41ff33..049bb3cec22 100644
--- a/lldb/include/lldb/Core/Event.h
+++ b/lldb/include/lldb/Core/Event.h
@@ -59,6 +59,8 @@ public:
EventDataBytes(const char *cstr);
+ EventDataBytes(llvm::StringRef str);
+
EventDataBytes(const void *src, size_t src_len);
~EventDataBytes() override;
diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h
index 257ed759da2..1ee815071c2 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -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 IOHandler {
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);
diff --git a/lldb/include/lldb/Core/Log.h b/lldb/include/lldb/Core/Log.h
index 39147a04b35..772474325a7 100644
--- a/lldb/include/lldb/Core/Log.h
+++ b/lldb/include/lldb/Core/Log.h
@@ -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)));
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 0dc80965cc7..a3dd42a6aca 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -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);
diff --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h
index 345b65e5939..6ba276e171c 100644
--- a/lldb/include/lldb/Interpreter/OptionValue.h
+++ b/lldb/include/lldb/Interpreter/OptionValue.h
@@ -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;
diff --git a/lldb/include/lldb/Interpreter/OptionValueProperties.h b/lldb/include/lldb/Interpreter/OptionValueProperties.h
index e472b24f1dd..86e702080c3 100644
--- a/lldb/include/lldb/Interpreter/OptionValueProperties.h
+++ b/lldb/include/lldb/Interpreter/OptionValueProperties.h
@@ -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,
diff --git a/lldb/include/lldb/Utility/AnsiTerminal.h b/lldb/include/lldb/Utility/AnsiTerminal.h
index 979d3418b59..5eaf2fd0e06 100644
--- a/lldb/include/lldb/Utility/AnsiTerminal.h
+++ b/lldb/include/lldb/Utility/AnsiTerminal.h
@@ -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 FormatAnsiTerminalCodes(const char *format,
#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;
}
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 7641d7807aa..e8f55424ae7 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -930,14 +930,15 @@ const char *SBDebugger::GetPrompt() const {
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 {
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 6f465b531c2..1686c21b575 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -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));
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 11a4721a924..cdda76bc26d 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -482,8 +482,8 @@ void CommandObjectExpression::GetMultilineExpression() {
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));
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 7a727479e16..806f9151bf2 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -276,7 +276,7 @@ Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
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())
diff --git a/lldb/source/Core/Event.cpp b/lldb/source/Core/Event.cpp
index cb753a90356..85da9b855fa 100644
--- a/lldb/source/Core/Event.cpp
+++ b/lldb/source/Core/Event.cpp
@@ -113,6 +113,10 @@ EventDataBytes::EventDataBytes(const char *cstr) : m_bytes() {
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);
}
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index fddf755593f..536b0689b07 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -132,10 +132,10 @@ IOHandlerConfirm::IOHandlerConfirm(Debugger &debugger, const char *prompt,
: 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(Debugger &debugger, const char *prompt,
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(IOHandler &io_handler,
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::GetContinuationPrompt() {
: 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)
diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index 4685b26a320..d7f2d74b846 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -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
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index eca4278d235..f2eec88ccf4 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -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(const StringList &commands,
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::HandleCommandsFromFile(
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::GetLLDBCommandsFromIOHandler(
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::GetPythonCommandsFromIOHandler(
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 force_create,
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
diff --git a/lldb/source/Interpreter/OptionValue.cpp b/lldb/source/Interpreter/OptionValue.cpp
index 1d472e37a7b..bacdbc59791 100644
--- a/lldb/source/Interpreter/OptionValue.cpp
+++ b/lldb/source/Interpreter/OptionValue.cpp
@@ -419,10 +419,10 @@ const char *OptionValue::GetStringValue(const char *fail_value) const {
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;
diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp
index d5f7e3f18a0..a6fed486c5a 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -491,7 +491,7 @@ const char *OptionValueProperties::GetPropertyAtIndexAsString(
}
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();
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 1fcc4660853..25a38321298 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3701,7 +3701,8 @@ const char *TargetProperties::GetArg0() const {
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::GetStandardInputPath() const {
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::GetStandardOutputPath() const {
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::GetExpressionPrefixContentsAsCString() {
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() {
OpenPOWER on IntegriCloud