diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-09-06 08:40:31 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-09-06 08:40:31 +0000 |
commit | 7841e80e79f231d564bf9f849c8e3cad171b7ba4 (patch) | |
tree | f105c895dc06e49d0fa0a8bf01979c8c2bbb9775 /lldb/source/Commands/CommandObjectSettings.cpp | |
parent | 0d50c4e060ffea2edcb08b94a6ff7694275e112b (diff) | |
download | llvm-7841e80e79f231d564bf9f849c8e3cad171b7ba4.zip llvm-7841e80e79f231d564bf9f849c8e3cad171b7ba4.tar.gz llvm-7841e80e79f231d564bf9f849c8e3cad171b7ba4.tar.bz2 |
[lldb][NFC] Remove Args::StripSpaces
This just reimplemented llvm::StringRef::[r/l]trim().
llvm-svn: 371181
Diffstat (limited to 'lldb/source/Commands/CommandObjectSettings.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectSettings.cpp | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index 5f6a4dc..8c62bea 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -205,16 +205,13 @@ protected: } // Split the raw command into var_name and value pair. - llvm::StringRef raw_str(command); - std::string var_value_string = raw_str.split(var_name).second.str(); - const char *var_value_cstr = - Args::StripSpaces(var_value_string, true, false, false); + llvm::StringRef var_value(command); + var_value = var_value.split(var_name).second.ltrim(); Status error; - if (m_options.m_global) { + if (m_options.m_global) error = GetDebugger().SetPropertyValue(nullptr, eVarSetOperationAssign, - var_name, var_value_cstr); - } + var_name, var_value); if (error.Success()) { // FIXME this is the same issue as the one in commands script import @@ -225,7 +222,7 @@ protected: ExecutionContext exe_ctx(m_exe_ctx); m_exe_ctx.Clear(); error = GetDebugger().SetPropertyValue(&exe_ctx, eVarSetOperationAssign, - var_name, var_value_cstr); + var_name, var_value); } if (error.Fail()) { @@ -646,13 +643,11 @@ protected: } // Split the raw command into var_name and value pair. - llvm::StringRef raw_str(command); - std::string var_value_string = raw_str.split(var_name).second.str(); - const char *var_value_cstr = - Args::StripSpaces(var_value_string, true, true, false); + llvm::StringRef var_value(command); + var_value = var_value.split(var_name).second.trim(); Status error(GetDebugger().SetPropertyValue( - &m_exe_ctx, eVarSetOperationRemove, var_name, var_value_cstr)); + &m_exe_ctx, eVarSetOperationRemove, var_name, var_value)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -744,13 +739,11 @@ protected: } // Split the raw command into var_name, index_value, and value triple. - llvm::StringRef raw_str(command); - std::string var_value_string = raw_str.split(var_name).second.str(); - const char *var_value_cstr = - Args::StripSpaces(var_value_string, true, true, false); + llvm::StringRef var_value(command); + var_value = var_value.split(var_name).second.trim(); Status error(GetDebugger().SetPropertyValue( - &m_exe_ctx, eVarSetOperationReplace, var_name, var_value_cstr)); + &m_exe_ctx, eVarSetOperationReplace, var_name, var_value)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -848,13 +841,11 @@ protected: } // Split the raw command into var_name, index_value, and value triple. - llvm::StringRef raw_str(command); - std::string var_value_string = raw_str.split(var_name).second.str(); - const char *var_value_cstr = - Args::StripSpaces(var_value_string, true, true, false); + llvm::StringRef var_value(command); + var_value = var_value.split(var_name).second.trim(); Status error(GetDebugger().SetPropertyValue( - &m_exe_ctx, eVarSetOperationInsertBefore, var_name, var_value_cstr)); + &m_exe_ctx, eVarSetOperationInsertBefore, var_name, var_value)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -949,13 +940,11 @@ protected: } // Split the raw command into var_name, index_value, and value triple. - llvm::StringRef raw_str(command); - std::string var_value_string = raw_str.split(var_name).second.str(); - const char *var_value_cstr = - Args::StripSpaces(var_value_string, true, true, false); + llvm::StringRef var_value(command); + var_value = var_value.split(var_name).second.trim(); Status error(GetDebugger().SetPropertyValue( - &m_exe_ctx, eVarSetOperationInsertAfter, var_name, var_value_cstr)); + &m_exe_ctx, eVarSetOperationInsertAfter, var_name, var_value)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -1041,13 +1030,11 @@ protected: // character string later on. // Split the raw command into var_name and value pair. - llvm::StringRef raw_str(command); - std::string var_value_string = raw_str.split(var_name).second.str(); - const char *var_value_cstr = - Args::StripSpaces(var_value_string, true, true, false); + llvm::StringRef var_value(command); + var_value = var_value.split(var_name).second.trim(); Status error(GetDebugger().SetPropertyValue( - &m_exe_ctx, eVarSetOperationAppend, var_name, var_value_cstr)); + &m_exe_ctx, eVarSetOperationAppend, var_name, var_value)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); |