summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/Debugger.cpp13
-rw-r--r--lldb/source/Core/Disassembler.cpp5
-rw-r--r--lldb/source/Core/UserSettingsController.cpp23
3 files changed, 16 insertions, 25 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 24715ec2129..e66fb2358df 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -276,11 +276,9 @@ LoadPluginCallbackType Debugger::g_load_plugin_callback = nullptr;
Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
VarSetOperationType op,
- const char *property_path, const char *value) {
- bool is_load_script =
- strcmp(property_path, "target.load-script-from-symbol-file") == 0;
- bool is_escape_non_printables =
- strcmp(property_path, "escape-non-printables") == 0;
+ llvm::StringRef property_path, llvm::StringRef value) {
+ bool is_load_script = (property_path == "target.load-script-from-symbol-file");
+ bool is_escape_non_printables = (property_path == "escape-non-printables");
TargetSP target_sp;
LoadScriptFromSymFile load_script_old_value;
if (is_load_script && exe_ctx->GetTargetSP()) {
@@ -291,7 +289,7 @@ Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
Error error(Properties::SetPropertyValue(exe_ctx, op, property_path, value));
if (error.Success()) {
// FIXME it would be nice to have "on-change" callbacks for properties
- if (strcmp(property_path, g_properties[ePropertyPrompt].name) == 0) {
+ if (property_path == g_properties[ePropertyPrompt].name) {
llvm::StringRef new_prompt = GetPrompt();
std::string str = lldb_utility::ansi::FormatAnsiTerminalCodes(
new_prompt, GetUseColor());
@@ -302,8 +300,7 @@ Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
new Event(CommandInterpreter::eBroadcastBitResetPrompt,
new EventDataBytes(new_prompt)));
GetCommandInterpreter().BroadcastEvent(prompt_change_event_sp);
- } else if (strcmp(property_path, g_properties[ePropertyUseColor].name) ==
- 0) {
+ } else if (property_path == g_properties[ePropertyUseColor].name) {
// use-color changed. Ping the prompt so it can reset the ansi terminal
// codes.
SetPrompt(GetPrompt());
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index c55ad1c1755..7cac29491c8 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -1321,9 +1321,8 @@ void PseudoInstruction::SetOpcode(size_t opcode_size, void *opcode_data) {
}
}
-void PseudoInstruction::SetDescription(const char *description) {
- if (description && strlen(description) > 0)
- m_description = description;
+void PseudoInstruction::SetDescription(llvm::StringRef description) {
+ m_description = description;
}
Instruction::Operand Instruction::Operand::BuildRegister(ConstString &r) {
diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp
index 00fbc4b8a9b..92c3c8440d1 100644
--- a/lldb/source/Core/UserSettingsController.cpp
+++ b/lldb/source/Core/UserSettingsController.cpp
@@ -24,7 +24,7 @@ using namespace lldb;
using namespace lldb_private;
lldb::OptionValueSP
-Properties::GetPropertyValue(const ExecutionContext *exe_ctx, const char *path,
+Properties::GetPropertyValue(const ExecutionContext *exe_ctx, llvm::StringRef path,
bool will_modify, Error &error) const {
OptionValuePropertiesSP properties_sp(GetValueProperties());
if (properties_sp)
@@ -33,8 +33,8 @@ Properties::GetPropertyValue(const ExecutionContext *exe_ctx, const char *path,
}
Error Properties::SetPropertyValue(const ExecutionContext *exe_ctx,
- VarSetOperationType op, const char *path,
- const char *value) {
+ VarSetOperationType op, llvm::StringRef path,
+ llvm::StringRef value) {
OptionValuePropertiesSP properties_sp(GetValueProperties());
if (properties_sp)
return properties_sp->SetSubValue(exe_ctx, op, path, value);
@@ -60,7 +60,7 @@ void Properties::DumpAllDescriptions(CommandInterpreter &interpreter,
}
Error Properties::DumpPropertyValue(const ExecutionContext *exe_ctx,
- Stream &strm, const char *property_path,
+ Stream &strm, llvm::StringRef property_path,
uint32_t dump_mask) {
OptionValuePropertiesSP properties_sp(GetValueProperties());
if (properties_sp) {
@@ -93,16 +93,11 @@ Properties::GetSubProperty(const ExecutionContext *exe_ctx,
const char *Properties::GetExperimentalSettingsName() { return "experimental"; }
-bool Properties::IsSettingExperimental(const char *setting) {
- if (setting == nullptr)
+bool Properties::IsSettingExperimental(llvm::StringRef setting) {
+ if (setting.empty())
return false;
- const char *experimental = GetExperimentalSettingsName();
- const char *dot_pos = strchr(setting, '.');
- if (dot_pos == nullptr)
- return strcmp(experimental, setting) == 0;
- else {
- size_t first_elem_len = dot_pos - setting;
- return strncmp(experimental, setting, first_elem_len) == 0;
- }
+ llvm::StringRef experimental = GetExperimentalSettingsName();
+ size_t dot_pos = setting.find_first_of('.');
+ return setting.take_front(dot_pos) == experimental;
}
OpenPOWER on IntegriCloud